commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
93ee01752d1ce08b1b8a0650597a3c243056f36a | Evgeny Safronov | 2015-07-10T21:55:18 | [Doc] Minor update. | diff --git a/src/decode.rs b/src/decode.rs
index ab09fd6..7657486 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -286,7 +286,8 @@ pub fn read_nil<R>(rd: &mut R) -> Result<(), FixedValueReadError>
///
/// # Errors
///
-/// This function will return `FixedValueReadError` on any I/O error while reading the bool mark... | 1 | 6 | 3 |
4abaa9ca5ceae445663304eba33bff56169860e6 | Evgeny Safronov | 2015-07-10T19:33:53 | [Decode] Documentation update.
All single-byte reader functions has been marked as interruption-safe. | diff --git a/src/decode.rs b/src/decode.rs
index 85d4fd6..ab09fd6 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -249,7 +249,7 @@ fn read_marker<R>(rd: &mut R) -> Result<Marker, MarkerReadError>
where R: Read
{
match rd.read_u8() {
- Ok(val) => Ok(Marker::from_u8(val)),
+ Ok(val) => Ok(Mark... | 1 | 21 | 6 |
91ab88df2aeb298b1bfd0924461d5b25b9b91915 | Evgeny Safronov | 2015-07-09T22:57:31 | [Decode] Test `read_nil` interruption behavior.
Currently it will spin on EINTR received. I think it's not the best solution. | diff --git a/src/decode.rs b/src/decode.rs
index 941856f..85d4fd6 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -260,10 +260,16 @@ fn read_marker<R>(rd: &mut R) -> Result<Marker, MarkerReadError>
///
/// # Errors
///
-/// This function will return `FixedValueReadError` on any I/O error while reading the nil mark... | 2 | 39 | 1 |
2a160660928462ef31c95a72b72db56b3aa97aeb | Michael Budde | 2015-07-05T10:41:38 | Implement `std::error::Error` trait for error types | diff --git a/src/decode.rs b/src/decode.rs
index d65259f..941856f 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1,3 +1,5 @@
+use std::error::Error;
+use std::fmt;
use std::io;
use std::io::Read;
use std::result::Result;
@@ -20,6 +22,28 @@ pub enum ReadError {
Io(io::Error),
}
+impl Error for ReadError {... | 2 | 266 | 0 |
26b51e6725a6ac6696270732b908651326b54641 | Evgeny Safronov | 2015-07-05T08:11:07 | [UT] Added encoder test with growable buffer. | diff --git a/tests/func/encode/encoder.rs b/tests/func/encode/encoder.rs
index abcffb0..e3d35db 100644
--- a/tests/func/encode/encoder.rs
+++ b/tests/func/encode/encoder.rs
@@ -298,6 +298,13 @@ fn pass_enum_variant_with_arg() {
assert_eq!(out, buf);
}
-// посмотреть в инете про ADT и Msgpack.
-// сделать.
-// c... | 1 | 10 | 3 |
1fa3ab1bc5ad7923a45904e6aaee00a9506ea3ef | Evgeny Safronov | 2015-07-05T08:02:50 | [Encode] Forwarding errors. | diff --git a/src/encode.rs b/src/encode.rs
index 812cd21..ee4d7ab 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -800,13 +800,14 @@ use super::{
use super::{
WriteError,
FixedValueWriteError,
+ ValueWriteError,
};
#[derive(Debug)]
pub enum Error {
/// Failed to write MessagePack'ed single-byt... | 1 | 5 | 6 |
ef77fce733d150c7123c269bd68a1a8546ff18ec | Evgeny Safronov | 2015-07-04T18:14:26 | [CC] Code reuse. | diff --git a/src/decode.rs b/src/decode.rs
index 6bb57e7..d65259f 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -333,10 +333,7 @@ pub fn read_u8<R>(rd: &mut R) -> Result<u8, ValueReadError>
pub fn read_u16<R>(rd: &mut R) -> Result<u16, ValueReadError>
where R: Read
{
- match try!(read_marker(rd)) {
- ... | 1 | 7 | 28 |
43ebaf3073190440c122c06a58e827d743b19dc9 | Evgeny Safronov | 2015-07-04T18:10:43 | [CC] Suppress dead code until ValueRef comes. | diff --git a/src/value.rs b/src/value.rs
index 43d87d9..7590373 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -35,25 +35,25 @@ pub enum Value {
Ext(i8, Vec<u8>),
}
-#[derive(Clone, Debug, PartialEq)]
-enum ValueRef<'a> {
- /// Nil represents nil.
- Nil,
- /// Boolean represents true or false.
- Bo... | 1 | 22 | 22 |
1c62b251936c45b84113e4e5d9d27ff38dae253f | Evgeny Safronov | 2015-06-28T17:18:14 | [Decode/Encode] Variant encoding/decoding review. | diff --git a/src/decode.rs b/src/decode.rs
index 38d8cd5..6bb57e7 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1513,22 +1513,25 @@ impl<R: Read> serialize::Decoder for Decoder<R> {
fn read_enum<T, F>(&mut self, _name: &str, f: F) -> Result<T>
where F: FnOnce(&mut Self) -> Result<T>
{
- f... | 4 | 83 | 27 |
a2f7afc28ba233c33fd89097bfcc7db8a5ab60ed | Evgeny Safronov | 2015-06-27T09:40:47 | [Doc] More docs for encoder implementation. | diff --git a/src/encode.rs b/src/encode.rs
index 05d2e56..6930c89 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -913,6 +913,14 @@ impl<'a> serialize::Encoder for Encoder<'a> {
write_str(&mut self.wr, val).map_err(From::from)
}
+ /// Encodes and tries to write the enum value into the Write.
+ /... | 1 | 8 | 0 |
31719652e0d397f462c95d71c5deaf71451e2a46 | Evgeny Safronov | 2015-06-25T20:57:24 | [Detail] Minor code eye-candy change. | diff --git a/src/decode.rs b/src/decode.rs
index 7166749..38d8cd5 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -291,6 +291,17 @@ fn read_numeric_data<R, D>(rd: &mut R) -> Result<D, ValueReadError>
}
}
+#[inline]
+fn read_numeric<R, D>(rd: &mut R, marker: Marker) -> Result<D, ValueReadError>
+ where R: R... | 1 | 12 | 4 |
45c7f354642f270208215f6dd548131cb8b9b477 | Evgeny Safronov | 2015-06-25T20:53:28 | [Misc] Planning note. | diff --git a/src/encode.rs b/src/encode.rs
index 9ad2f54..05d2e56 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -919,6 +919,7 @@ impl<'a> serialize::Encoder for Encoder<'a> {
f(self)
}
+ // TODO: Check carefully what that id/idx actually mean.
fn emit_enum_variant<F>(&mut self, _name: &str, ... | 1 | 1 | 0 |
48e92533f778c6de9030d1b73107129ab159a9f5 | Evgeny Safronov | 2015-06-25T20:52:11 | [Encode] Allow to pack enum variants. | diff --git a/src/encode.rs b/src/encode.rs
index 329f7c2..9ad2f54 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -913,22 +913,24 @@ impl<'a> serialize::Encoder for Encoder<'a> {
write_str(&mut self.wr, val).map_err(From::from)
}
- fn emit_enum<F>(&mut self, _name: &str, _f: F) -> Result<(), Error>... | 2 | 26 | 6 |
5908f4d03ee3100bd93138df1967da9c2c504db6 | Evgeny Safronov | 2015-06-25T20:37:40 | [Decode] Doing the same steps for struct enums. | diff --git a/src/decode.rs b/src/decode.rs
index 895317c..7166749 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1530,10 +1530,17 @@ impl<R: Read> serialize::Decoder for Decoder<R> {
f(self)
}
- fn read_enum_struct_variant<T, F>(&mut self, _names: &[&str], _f: F) -> Result<T>
- where F: Fn... | 2 | 28 | 4 |
3d209017f2fe4f66531472ea09175c09cc56a966 | Evgeny Safronov | 2015-06-25T20:33:27 | [Decode] Also checking variant type overflow. | diff --git a/src/decode.rs b/src/decode.rs
index 8576f82..895317c 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1508,14 +1508,17 @@ impl<R: Read> serialize::Decoder for Decoder<R> {
f(self)
}
- fn read_enum_variant<T, F>(&mut self, _names: &[&str], mut f: F) -> Result<T>
+ fn read_enum_varian... | 2 | 25 | 3 |
3e273a8d0d0ac1685f0e921dbbabf4c3d740a911 | Evgeny Safronov | 2015-06-25T20:31:24 | [Decode] Checking sequence mismatch.
When decoding variant types. | diff --git a/src/decode.rs b/src/decode.rs
index 08564cb..8576f82 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1517,8 +1517,7 @@ impl<R: Read> serialize::Decoder for Decoder<R> {
// TODO: Check overflow.
f(self, id)
} else {
- // TODO: Type mismatch.
- unim... | 2 | 21 | 2 |
31628e4c93595ed17f2ef547a82906a51aaf357e | Evgeny Safronov | 2015-06-25T20:24:57 | [Decode] Decoding Rust variant types. | diff --git a/src/decode.rs b/src/decode.rs
index a0a4c91..08564cb 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1502,12 +1502,32 @@ impl<R: Read> serialize::Decoder for Decoder<R> {
Ok(try!(read_str_data(&mut self.rd, len, &mut buf[..])).to_string())
}
- fn read_enum<T, F>(&mut self, _name: &str... | 2 | 43 | 6 |
2dec42d618a8890be6387f6bd7f01803c9074ac2 | Evgeny Safronov | 2015-06-15T09:17:36 | [UT] Minor codestyle. | diff --git a/tests/func/decode/value.rs b/tests/func/decode/value.rs
index 0510b47..81a293d 100644
--- a/tests/func/decode/value.rs
+++ b/tests/func/decode/value.rs
@@ -100,7 +100,7 @@ fn from_fixmap_decode_value() {
let expected = Value::Map(vec![
(Value::Integer(Integer::U64(42)), Value::Integer(Integ... | 1 | 1 | 1 |
41f01f737e3b5a9be5f519b16a7a1c2a0640aee0 | Evgeny Safronov | 2015-06-15T09:04:21 | [CC] Decomposing the tests. | diff --git a/src/decode.rs b/src/decode.rs
index a2dce98..a0a4c91 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1328,129 +1328,6 @@ pub fn read_value<R>(rd: &mut R) -> Result<Value, Error>
Ok(val)
}
-#[cfg(test)]
-mod tests {
-
-use std::io::Cursor;
-
-use super::*;
-
-#[test]
-fn from_null_decode_value() ... | 2 | 114 | 123 |
f26f577fab6780ad10abb8f38dc2a79139183c0e | Evgeny Safronov | 2015-06-15T08:03:55 | [CC] Code clean. | diff --git a/src/decode.rs b/src/decode.rs
index 13de417..a2dce98 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -306,7 +306,7 @@ pub fn read_u8<R>(rd: &mut R) -> Result<u8, ValueReadError>
where R: Read
{
match try!(read_marker(rd)) {
- Marker::U8 => Ok(try!(read_numeric_data(rd))),
+ Marke... | 1 | 8 | 8 |
fdcf9495667f212f6e5b5e8f676b887cc8e24a4c | Evgeny Safronov | 2015-06-14T14:19:36 | [CC] Macro elimination in decoding module, final. | diff --git a/src/decode.rs b/src/decode.rs
index 5defe51..13de417 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -217,34 +217,6 @@ pub fn read_nfix<R>(rd: &mut R) -> Result<i8, FixedValueReadError>
}
}
-macro_rules! make_read_data_fn {
- (deduce, $reader:ident, $decoder:ident, 0)
- => ($reader.$dec... | 1 | 26 | 49 |
d2dda1caa2bf100da6d9ed4497f0a4eb58b5dfd4 | Evgeny Safronov | 2015-06-14T08:41:03 | [CC] Macro elimination, part 2. | diff --git a/src/decode.rs b/src/decode.rs
index a63a195..5defe51 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -237,8 +237,6 @@ macro_rules! make_read_data_fn {
($t:ty, $name:ident, $decoder:ident) => (make_read_data_fn!(gen, $t, 1, $name, $decoder););
}
-make_read_data_fn!(u16, read_data_u16, read_u16);
-... | 1 | 22 | 26 |
d2951762da70e950ae11bf2e009b058fddf8dfc1 | Evgeny Safronov | 2015-06-14T08:36:13 | [CC] One macro-generated function less. | diff --git a/src/decode.rs b/src/decode.rs
index 3c17c3d..a63a195 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -237,7 +237,6 @@ macro_rules! make_read_data_fn {
($t:ty, $name:ident, $decoder:ident) => (make_read_data_fn!(gen, $t, 1, $name, $decoder););
}
-make_read_data_fn!(u8, read_data_u8, read_u8);
m... | 1 | 35 | 36 |
01dc36058049b24a08808a3e7e92ee3e61c48534 | Evgeny Safronov | 2015-06-13T20:12:40 | [CC] Using type inferring. | diff --git a/src/decode.rs b/src/decode.rs
index ab0f3dc..3c17c3d 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -325,7 +325,7 @@ pub fn read_u8<R>(rd: &mut R) -> Result<u8, ValueReadError>
where R: Read
{
match try!(read_marker(rd)) {
- Marker::U8 => Ok(try!(read_numeric_data::<R, u8>(rd))),
+ ... | 1 | 2 | 2 |
04987293c27e1aba067234fb53f07bc2743b297f | Evgeny Safronov | 2015-06-12T19:05:12 | [CC] Macro elimination, part 1. | diff --git a/src/decode.rs b/src/decode.rs
index c0a5712..ab0f3dc 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -248,6 +248,68 @@ make_read_data_fn!(i64, read_data_i64, read_i64);
make_read_data_fn!(f32, read_data_f32, read_f32);
make_read_data_fn!(f64, read_data_f64, read_f64);
+trait BigEndianRead {
+ fn r... | 1 | 64 | 2 |
56955f3787333fbb44dabc352f2b20b9c7c56d51 | Evgeny Safronov | 2015-06-11T08:11:33 | [Planning] Minor note. | diff --git a/src/decode.rs b/src/decode.rs
index 5cedf7f..c0a5712 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1166,6 +1166,7 @@ fn read_ext_body<R>(rd: &mut R, len: usize) -> Result<(i8, Vec<u8>), Error>
pub fn read_value<R>(rd: &mut R) -> Result<Value, Error>
where R: Read
{
+ // TODO: Looks creepy.
... | 1 | 1 | 0 |
2121f8732f093cfca06fc29a47a09ec9267fe96b | Evgeny Safronov | 2015-06-07T10:38:27 | [Bench] Reenabling almost all benches now. | diff --git a/benches/bench.rs b/benches/bench.rs
index 088b8c8..ff45d65 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -5,11 +5,7 @@ extern crate rmp as msgpack;
use test::Bencher;
-use msgpack::decode::{
- read_i64_loosely,
- read_str,
- read_value,
-};
+use msgpack::decode::*;
#[bench]
fn f... | 1 | 17 | 21 |
2aa4db92993e014fd49d3f3fb74fa0b3e5bdf81d | Evgeny Safronov | 2015-05-31T15:12:31 | [Bench] Added complex benchmark.
This one measures decoding speed from [None, 42, 3.1415, "Lorem ipsum dolor sit amet", {"key": "value"}] encoded byte array. | diff --git a/benches/bench.rs b/benches/bench.rs
index e1b2bb9..088b8c8 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -43,6 +43,29 @@ fn from_string_read_value(b: &mut Bencher) {
});
}
+#[bench]
+fn from_complex_read_value(b: &mut Bencher) {
+ let buf = [
+ 0x95, // Fixed array with 5 len.
+... | 1 | 23 | 0 |
095fec9403bfb47d64f1bc5255e2224ae5253484 | Evgeny Safronov | 2015-05-31T15:03:34 | [UT] Naming. | diff --git a/tests/func/decode/null.rs b/tests/func/decode/null.rs
index 5a985e7..a983950 100644
--- a/tests/func/decode/null.rs
+++ b/tests/func/decode/null.rs
@@ -3,7 +3,7 @@ use std::io::Cursor;
use msgpack::decode::*;
#[test]
-fn pass_read_nil() {
+fn pass() {
let buf = [0xc0];
let mut cur = Cursor::n... | 1 | 3 | 3 |
d55649c4019ad7cddbf8259a0960519f4584e788 | Evgeny Safronov | 2015-05-31T14:58:57 | [CC] Dead code elimination. | diff --git a/src/decode.rs b/src/decode.rs
index 2b0432d..5cedf7f 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -748,22 +748,6 @@ fn read_str_data<'r, R>(rd: &mut R, len: u32, buf: &'r mut[u8]) -> Result<&'r st
Ok(n) => Err(DecodeStringError::InvalidDataCopy(&buf[..n], ReadError::UnexpectedEOF)),
... | 1 | 0 | 16 |
10d1d2c1db1c18513e9ed1a13f8d80975809eab5 | Evgeny Safronov | 2015-05-31T14:58:02 | [Misc] Refactoring notice. | diff --git a/src/decode.rs b/src/decode.rs
index b81effb..2b0432d 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -987,6 +987,7 @@ fn read_fixext_data<R>(rd: &mut R, buf: &mut [u8]) -> Result<i8, ValueReadError>
/// instances of `ErrorKind::Interrupted` are handled by this function and the underlying operation
/// ... | 1 | 1 | 0 |
463c0327616af1f2101dfea771b2ffd61c27ba09 | Evgeny Safronov | 2015-05-31T11:45:08 | [Decode] Read full function review. | diff --git a/src/decode.rs b/src/decode.rs
index 5ff1f7c..b81effb 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -739,14 +739,14 @@ fn read_str_data<'r, R>(rd: &mut R, len: u32, buf: &'r mut[u8]) -> Result<&'r st
// Trying to copy exact `len` bytes.
match read_full(rd, buf) {
- Ok(()) => {
+ ... | 1 | 27 | 12 |
702703b37ae211186ed7775c1c146a806694dc01 | Evgeny Safronov | 2015-05-30T17:01:54 | [UT] API notice. | diff --git a/tests/func/decode/string.rs b/tests/func/decode/string.rs
index c298ccd..444e27e 100644
--- a/tests/func/decode/string.rs
+++ b/tests/func/decode/string.rs
@@ -177,6 +177,7 @@ fn from_str_strfix_exact_buffer() {
#[test]
fn from_str_strfix_insufficient_bytes() {
// The buffer contains "le messag", wh... | 1 | 1 | 0 |
0ac6407af571b7bcda63c6720ce53d19e2b30e77 | Evgeny Safronov | 2015-05-30T16:59:57 | [UT] Minor commenting. | diff --git a/tests/func/decode/string.rs b/tests/func/decode/string.rs
index b7614ea..c298ccd 100644
--- a/tests/func/decode/string.rs
+++ b/tests/func/decode/string.rs
@@ -176,6 +176,7 @@ fn from_str_strfix_exact_buffer() {
#[test]
fn from_str_strfix_insufficient_bytes() {
+ // The buffer contains "le messag", ... | 1 | 1 | 0 |
e765f1ddf8788a0867d99b9da8a828eda8e377b4 | Evgeny Safronov | 2015-05-30T08:37:20 | [Common] Namespacing. | diff --git a/benches/bench.rs b/benches/bench.rs
index bf3dd20..e1b2bb9 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -5,11 +5,10 @@ extern crate rmp as msgpack;
use test::Bencher;
-use msgpack::read_value;
-
use msgpack::decode::{
read_i64_loosely,
read_str,
+ read_value,
};
#[bench]
d... | 2 | 3 | 2 |
33eedeefe9cbff7587671448dd1b0f38129d4cf4 | Evgeny Safronov | 2015-05-30T08:33:56 | [Bench] Reenabling benchmarks. | diff --git a/benches/bench.rs b/benches/bench.rs
new file mode 100644
index 0000000..bf3dd20
--- /dev/null
+++ b/benches/bench.rs
@@ -0,0 +1,85 @@
+#![feature(test)]
+
+extern crate test;
+extern crate rmp as msgpack;
+
+use test::Bencher;
+
+use msgpack::read_value;
+
+use msgpack::decode::{
+ read_i64_loosely,
+ ... | 2 | 85 | 39 |
0ad8279a6be38f4f7fd6c7273813e47243c18bcf | Evgeny Safronov | 2015-05-30T08:33:38 | [Common] Export Value struct, cause it's ready. | diff --git a/src/lib.rs b/src/lib.rs
index 0cac158..aa96f0f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -118,6 +118,8 @@ pub mod decode;
// TODO: Not ready yet.
mod value;
+pub use value::Value;
+
// Suppressed due to instability.
// #[cfg(test)]
// mod bench; | 1 | 2 | 0 |
65de544b9f72c834121f2663ea6f7c431f5c4c01 | Evgeny Safronov | 2015-05-27T21:24:57 | [Common] Cargo update. | diff --git a/Cargo.lock b/Cargo.lock
index 1707952..6bf9521 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
[root]
name = "rmp"
-version = "0.1.1"
+version = "0.2.0"
dependencies = [
"byteorder 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.14 (registry+https://gith... | 2 | 2 | 2 |
891a30bf6a94a9d8f48bb5fca13200e08a8e4418 | Evgeny Safronov | 2015-05-27T21:22:36 | [Encode] Make value encoding module public. | diff --git a/src/encode.rs b/src/encode.rs
index 9de800c..329f7c2 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -681,7 +681,7 @@ pub fn write_ext_meta<W>(wr: &mut W, len: u32, typeid: i8) -> Result<Marker, Val
Ok(marker)
}
-mod value {
+pub mod value {
use std::convert::From;
use std::io::Write; | 1 | 1 | 1 |
690d50dfda255c6c3072a5d7f276f909e45cf02f | Evgeny Safronov | 2015-05-27T21:20:39 | [Common] Temporary hide value ref ADT. | diff --git a/src/value.rs b/src/value.rs
index 94e1816..43d87d9 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -36,7 +36,7 @@ pub enum Value {
}
#[derive(Clone, Debug, PartialEq)]
-pub enum ValueRef<'a> {
+enum ValueRef<'a> {
/// Nil represents nil.
Nil,
/// Boolean represents true or false. | 1 | 1 | 1 |
8739b952bc175a42bcbf54207e10e51dfbf82801 | Evgeny Safronov | 2015-05-27T19:38:42 | [Encode/Value] Value variant can now be encoded. | diff --git a/src/encode.rs b/src/encode.rs
index d7d1f6f..9de800c 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -567,6 +567,14 @@ pub fn write_bin_len<W>(wr: &mut W, len: u32) -> Result<Marker, ValueWriteError>
}
}
+// TODO: Docs, range check, example, visibility.
+fn write_bin<W>(wr: &mut W, data: &[u8]) -... | 1 | 53 | 2 |
7895c977dce12dd6fa933087d9e602a71a0eaa48 | Evgeny Safronov | 2015-05-27T16:31:03 | [CC] Pass converting function directly. | diff --git a/src/encode.rs b/src/encode.rs
index 6381f67..d7d1f6f 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -68,7 +68,7 @@ impl From<FixedValueWriteError> for ValueWriteError {
fn write_marker<W>(wr: &mut W, marker: Marker) -> Result<(), MarkerWriteError>
where W: Write
{
- wr.write_u8(marker.to_u8())... | 1 | 6 | 6 |
4d07deed8a9a405a51b1fcec0dba614262637483 | Evgeny Safronov | 2015-05-27T16:28:55 | [Encode/Value] Encoding nil value. | diff --git a/src/encode.rs b/src/encode.rs
index 636516a..6381f67 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -673,6 +673,61 @@ pub fn write_ext_meta<W>(wr: &mut W, len: u32, typeid: i8) -> Result<Marker, Val
Ok(marker)
}
+mod value {
+
+use std::convert::From;
+use std::io::Write;
+use std::result::Resul... | 1 | 56 | 1 |
efd14f08f7aefa14bce60feb253ef3a5961c6df8 | Evgeny Safronov | 2015-05-24T07:10:27 | [UT] Reenable temporary suppressed tests. | diff --git a/tests/func/decode/mod.rs b/tests/func/decode/mod.rs
index f0e1939..5dd0888 100644
--- a/tests/func/decode/mod.rs
+++ b/tests/func/decode/mod.rs
@@ -11,4 +11,4 @@ mod ext;
// High-level deserialize interface.
mod decoder;
-// mod value;
+mod value;
diff --git a/tests/func/decode/value.rs b/tests/func/de... | 2 | 39 | 42 |
014613a4e793471fc6456f940f725e74346bb6f9 | Evgeny Safronov | 2015-05-24T07:02:39 | [CC] Drop useless documentation. | diff --git a/src/decode.rs b/src/decode.rs
index 8a7f685..41a5772 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1009,8 +1009,6 @@ pub fn read_ext_meta<R>(rd: &mut R) -> Result<ExtMeta, ValueReadError>
Ok(meta)
}
-/// Contains: owned value decoding, owned error; owned result.
-// TODO: docs.
pub mod value ... | 1 | 0 | 2 |
b3280da43fb8c0d25fc60d241c70714afc4f3dc6 | Evgeny Safronov | 2015-05-24T07:02:22 | [Decode/Value] Make the module public. | diff --git a/src/decode.rs b/src/decode.rs
index 3d23839..8a7f685 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1011,7 +1011,7 @@ pub fn read_ext_meta<R>(rd: &mut R) -> Result<ExtMeta, ValueReadError>
/// Contains: owned value decoding, owned error; owned result.
// TODO: docs.
-mod value {
+pub mod value {
... | 1 | 1 | 1 |
93cf35b281887d5a5a4cf51864426671f9980680 | Evgeny Safronov | 2015-05-24T06:59:23 | [CC] Dead code elimination. | diff --git a/src/decode.rs b/src/decode.rs
index ba7d6c7..3d23839 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1013,7 +1013,6 @@ pub fn read_ext_meta<R>(rd: &mut R) -> Result<ExtMeta, ValueReadError>
// TODO: docs.
mod value {
-//use std::convert::From;
use std::io::Read;
use std::result::Result;
use std::... | 1 | 0 | 1 |
61013aef3e4a828637d9c01dcca9f021b5fabc63 | Evgeny Safronov | 2015-05-24T06:59:03 | [Doc] Minor documentation pack. | diff --git a/src/decode.rs b/src/decode.rs
index 30d6d17..ba7d6c7 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1155,7 +1155,11 @@ fn read_ext_body<R>(rd: &mut R, len: usize) -> Result<(i8, Vec<u8>), Error>
Ok((ty, vec))
}
-// TODO: docs; examples; incomplete.
+/// Attempts to read bytes from the given rea... | 1 | 5 | 1 |
b221fdf34e700723fad7bcf58fa85b40d1c4f563 | Evgeny Safronov | 2015-05-24T06:51:14 | [UT] Tiny cleanup. | diff --git a/src/decode.rs b/src/decode.rs
index e00b378..30d6d17 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1304,8 +1304,8 @@ fn from_null_decode_value() {
#[test]
fn from_pfix_decode_value() {
- let buf: &[u8] = &[0x1f];
- let mut cur = Cursor::new(buf);
+ let buf = [0x1f];
+ let mut cur = Cur... | 1 | 4 | 4 |
dd238116cc979e28a9190624730b58ad91a94f0a | Evgeny Safronov | 2015-05-23T16:27:10 | [Decode/Value] Finished with ext. | diff --git a/src/decode.rs b/src/decode.rs
index 642f605..e00b378 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1139,7 +1139,7 @@ fn read_map<R>(rd: &mut R, len: usize) -> Result<Vec<(Value, Value)>, Error>
fn read_bin_data<R>(rd: &mut R, len: usize) -> Result<Vec<u8>, Error>
where R: Read
{
- let mut ve... | 1 | 59 | 3 |
ceda7061233ac27cca5c7dc4fb4d852fe5602adb | Evgeny Safronov | 2015-05-23T15:41:41 | [Decode/Value] Decoding binary. | diff --git a/src/decode.rs b/src/decode.rs
index d3c0820..642f605 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1042,6 +1042,7 @@ use super::{
read_data_f32,
read_data_f64,
read_str_data,
+ read_full,
};
#[derive(Debug)]
@@ -1135,6 +1136,17 @@ fn read_map<R>(rd: &mut R, len: usize) -> Result<... | 1 | 28 | 1 |
0b655b969b5e488de52b28e92a2b79173d07ab27 | Evgeny Safronov | 2015-05-23T06:45:25 | [Decoder/Value] Map error handling. | diff --git a/src/decode.rs b/src/decode.rs
index 3b8b96d..d3c0820 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1055,6 +1055,8 @@ pub enum Error {
InvalidUtf8(Vec<u8>, Utf8Error),
InvalidArrayRead(Box<Error>),
+ InvalidMapKeyRead(Box<Error>),
+ InvalidMapValueRead(Box<Error>),
}
impl From<Mar... | 1 | 4 | 2 |
74c25b7d710a8dd3914b289c00b63e3873d7858d | Evgeny Safronov | 2015-05-23T06:43:44 | [Decode/Value] Decoding other kind of maps. | diff --git a/src/decode.rs b/src/decode.rs
index fe3b07f..3b8b96d 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1193,8 +1193,16 @@ pub fn read_value<R>(rd: &mut R) -> Result<Value, Error>
let map = try!(read_map(rd, len));
Value::Map(map)
}
-// Map16,
-// Map32,
+ ... | 1 | 10 | 2 |
eba3a129dba04527f876ca518d9fe90bb2f3246c | Evgeny Safronov | 2015-05-23T06:42:20 | [Decode/Value] Decoding fixmap. | diff --git a/src/decode.rs b/src/decode.rs
index 5056366..fe3b07f 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1111,6 +1111,28 @@ fn read_array<R>(rd: &mut R, len: usize) -> Result<Vec<Value>, Error>
Ok(vec)
}
+fn read_map<R>(rd: &mut R, len: usize) -> Result<Vec<(Value, Value)>, Error>
+ where R: Read... | 1 | 50 | 1 |
895c80c3387071613e563438f63c9613cdf190ae | Evgeny Safronov | 2015-05-21T21:10:45 | [Decode] Reading arrays into Value. | diff --git a/src/decode.rs b/src/decode.rs
index 4159108..5056366 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1045,7 +1045,7 @@ use super::{
};
#[derive(Debug)]
-pub enum Error<'r> {
+pub enum Error {
InvalidMarkerRead(ReadError),
InvalidDataRead(ReadError),
TypeMismatch(Marker),
@@ -1054,17 +... | 1 | 76 | 17 |
3a5f309e0dac54e8738809ad07e2f5599f8c80f7 | Evgeny Safronov | 2015-05-21T20:45:19 | [CC] Minor refactoring. | diff --git a/src/decode.rs b/src/decode.rs
index 1f3858c..4159108 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1086,6 +1086,16 @@ impl<'a, 'r> From<DecodeStringError<'a>> for Error<'r> {
}
}
+fn read_str<R>(rd: &mut R, len: u32) -> Result<String, Error>
+ where R: Read
+{
+ let mut vec: Vec<u8> = (0... | 1 | 19 | 23 |
8510c5739ff029f56d149d241f3bc016cf779890 | Evgeny Safronov | 2015-05-21T20:39:23 | [Value] Decoding strings. | diff --git a/src/decode.rs b/src/decode.rs
index 0a107db..1f3858c 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1016,6 +1016,7 @@ mod value {
//use std::convert::From;
use std::io::Read;
use std::result::Result;
+use std::str::Utf8Error;
use super::super::Marker;
pub use super::super::value::{
@@ -1028,6 +1... | 1 | 64 | 7 |
0371f4a694d195c564019bbd4e5b40a6c0fbfbbf | Evgeny Safronov | 2015-05-21T19:59:54 | [Value] Decoding floats. | diff --git a/src/decode.rs b/src/decode.rs
index fd6aa97..0a107db 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1018,7 +1018,12 @@ use std::io::Read;
use std::result::Result;
use super::super::Marker;
-pub use super::super::value::{Integer, Value};
+pub use super::super::value::{
+ Integer,
+ Float,
+ ... | 1 | 21 | 2 |
f6acc6d98abd8c615e4adaa66bdf66fd4d96025f | Evgeny Safronov | 2015-05-21T19:59:41 | [Misc] Update lock file. | diff --git a/Cargo.lock b/Cargo.lock
index 73273a9..1707952 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
[root]
name = "rmp"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"byteorder 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.14 (registry+https://gith... | 1 | 1 | 1 |
b8c26889ee7e6a7b69e8f2c066195cf95b9ea678 | Evgeny Safronov | 2015-05-18T17:35:03 | [Version] Bumped. Filled Cargo manifest. | diff --git a/Cargo.toml b/Cargo.toml
index ad94f1a..4e6ae3b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,11 +1,19 @@
[package]
name = "rmp"
-version = "0.1.0"
+version = "0.1.1"
authors = ["Evgeny Safronov <division494@gmail.com>"]
description = "Pure Rust MessagePack serialization implementation"
+document... | 1 | 9 | 1 |
e8fcf38d288b1b8dc03b4c63e159b63c33fc975f | Evgeny Safronov | 2015-05-17T12:58:48 | [CC] One mark less. | diff --git a/src/decode.rs b/src/decode.rs
index 96d4580..fd6aa97 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1075,7 +1075,6 @@ pub fn read_value<R>(rd: &mut R) -> Result<Value, Error>
Marker::I16 => Value::Integer(Integer::I64(try!(read_data_i16(rd)) as i64)),
Marker::I32 => Value::Integer(Int... | 1 | 0 | 1 |
823fb4c9403b64d88386af549396b5aea0f54adb | Evgeny Safronov | 2015-05-17T12:57:58 | [Decode] Integer decoding into a value. | diff --git a/src/decode.rs b/src/decode.rs
index 660e9d0..96d4580 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1025,6 +1025,13 @@ use super::{
ValueReadError,
read_marker,
read_data_u8,
+ read_data_u16,
+ read_data_u32,
+ read_data_u64,
+ read_data_i8,
+ read_data_i16,
+ read_data... | 1 | 16 | 7 |
d25826e35b9c5327cedea588b88f0f30bac26076 | Evgeny Safronov | 2015-05-17T12:52:21 | [Misc] Reincarnate value decoders. | diff --git a/src/decode.rs b/src/decode.rs
index 41635f8..660e9d0 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1014,54 +1014,54 @@ pub fn read_ext_meta<R>(rd: &mut R) -> Result<ExtMeta, ValueReadError>
mod value {
//use std::convert::From;
-//use std::io::Read;
-//use std::result::Result;
-
-//use super::supe... | 3 | 89 | 80 |
982dd0c221fccb441997f48da0bd9f1a405bda07 | Evgeny Safronov | 2015-05-16T11:19:50 | [CC] Naming. | diff --git a/src/decode.rs b/src/decode.rs
index 9b4f96d..41635f8 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -847,9 +847,9 @@ pub fn read_fixext1<R>(rd: &mut R) -> Result<(i8, u8), ValueReadError>
{
match try!(read_marker(rd)) {
Marker::FixExt1 => {
- let id = try!(read_data_i8(rd));
... | 1 | 2 | 2 |
d138568f205e6f23c36f0aa918a25c1343b8cee0 | Evgeny Safronov | 2015-05-16T11:19:17 | [Doc] Documentation added for fixext1 reader. | diff --git a/src/decode.rs b/src/decode.rs
index c2bc916..9b4f96d 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -830,7 +830,18 @@ pub fn read_bin_borrow(rd: &[u8]) -> Result<&[u8], ValueReadError> {
}
}
-// TODO: Docs.
+/// Attempts to read exactly 3 bytes from the given reader and interpret them as a fixex... | 1 | 12 | 1 |
3691958e523377a2ed8c39655e2c0d6e4d202b12 | Evgeny Safronov | 2015-05-16T11:16:24 | [Decode] Refactoring over fixext2 reader. | diff --git a/src/decode.rs b/src/decode.rs
index 57a96d9..c2bc916 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -844,15 +844,26 @@ pub fn read_fixext1<R>(rd: &mut R) -> Result<(i8, u8), ValueReadError>
}
}
-// TODO: Docs.
-pub fn read_fixext2<R>(rd: &mut R) -> Result<(i8, u16), ValueReadError>
+/// Attempts... | 2 | 21 | 10 |
7d1dd89cd3a0b6f15fa0a2c281a3322303b59f08 | Evgeny Safronov | 2015-05-16T11:13:07 | [Decode] Refactoring over fixext4 reader. | diff --git a/src/decode.rs b/src/decode.rs
index 35c6cc1..57a96d9 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -858,22 +858,26 @@ pub fn read_fixext2<R>(rd: &mut R) -> Result<(i8, u16), ValueReadError>
}
}
-// TODO: Docs; contains unsafe code
+/// Attempts to read exactly 6 bytes from the given reader and ... | 1 | 15 | 11 |
6671e1387f97ef9fad0f93731f46147ff4ad3801 | Evgeny Safronov | 2015-05-16T11:11:02 | [CC] Functional decomposition over ext readers. | diff --git a/src/decode.rs b/src/decode.rs
index 54c3493..35c6cc1 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -897,13 +897,8 @@ pub fn read_fixext8<R>(rd: &mut R) -> Result<(i8, [u8; 8]), ValueReadError>
{
match try!(read_marker(rd)) {
Marker::FixExt8 => {
- let id = try!(read_data_i8(rd... | 1 | 13 | 12 |
7a42df01992455afff877afe3eca5590bbc4fcec | Evgeny Safronov | 2015-05-16T11:01:27 | [Decode] Implemented fixext8 reader function. | diff --git a/src/decode.rs b/src/decode.rs
index 19acea2..54c3493 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -879,19 +879,30 @@ pub fn read_fixext4<R>(rd: &mut R) -> Result<(i8, [u8; 4]), ValueReadError>
}
}
-// TODO: Docs, error cases, type mismatch, unsufficient bytes, extra bytes
-#[allow(dead_code)]
... | 2 | 27 | 17 |
8527b32daee7fea36cc6483e6d1cc95d8f1b6e56 | Evgeny Safronov | 2015-05-15T23:02:16 | [Decode] Decoding fixext16. | diff --git a/src/decode.rs b/src/decode.rs
index dac39c9..19acea2 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -672,6 +672,8 @@ pub fn read_f64<R>(rd: &mut R) -> Result<f64, ValueReadError>
/// According to the MessagePack specification, the string format family stores an byte array in 1,
/// 2, 3, or 5 bytes of... | 2 | 50 | 20 |
b63a8d4b4c07ce2dfd7c60c17f37e6a542f237f3 | Evgeny Safronov | 2015-05-15T21:17:31 | [CC] Suppress warnings temporary. | diff --git a/src/decode.rs b/src/decode.rs
index 27e8236..dac39c9 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -878,6 +878,7 @@ pub fn read_fixext4<R>(rd: &mut R) -> Result<(i8, [u8; 4]), ValueReadError>
}
// TODO: Docs, error cases, type mismatch, unsufficient bytes, extra bytes
+#[allow(dead_code)]
fn read_... | 1 | 2 | 0 |
b76b5480a61f669c007c4bf720a88d5044cf5d4e | Evgeny Safronov | 2015-05-15T21:16:47 | [CC] Hide unnecessary mod. | diff --git a/src/lib.rs b/src/lib.rs
index fd4d362..269d042 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -112,7 +112,7 @@ pub use encode::serialize::{
Encoder,
};
-pub mod init;
+mod init;
pub mod encode;
pub mod decode; | 1 | 1 | 1 |
7e4735e179d768fa8f401a321b2872d7301f7af8 | Evgeny Safronov | 2015-05-15T07:36:25 | [CC] Warnings fix. | diff --git a/src/decode.rs b/src/decode.rs
index 5c9e1d7..73e08f6 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1198,24 +1198,24 @@ impl<R: Read> serialize::Decoder for Decoder<R> {
Ok(try!(read_str_data(&mut self.rd, len, &mut buf[..])).to_string())
}
- fn read_enum<T, F>(&mut self, name: &str,... | 1 | 13 | 13 |
03c6ea6919ab76606e283bfb13c0dba7942019de | Evgeny Safronov | 2015-05-15T07:33:58 | [Misc] Cleaning up for release. | diff --git a/src/decode.rs b/src/decode.rs
index ccfae6b..5c9e1d7 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -873,12 +873,12 @@ pub fn read_fixext4<R>(rd: &mut R) -> Result<(i8, [u8; 4]), ValueReadError>
Err(err) => Err(ValueReadError::InvalidDataRead(From::from(err))),
}
}... | 4 | 102 | 92 |
9ff5fde1b0cb92689e656d576751eecc40c21176 | Evgeny Safronov | 2015-05-14T22:09:43 | [Doc] Root module documentation. | diff --git a/src/lib.rs b/src/lib.rs
index 73eb627..1cffeed 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,93 @@
+//! # The Rust MessagePack Library
+//!
+//! RMP is a pure Rust [MessagePack](http://msgpack.org) implementation.
+//!
+//! MessagePack is an efficient binary serialization format.
+//!
+//! ## Usage
+... | 1 | 90 | 0 |
59b02e311f51a79fe1d5a8894409f50acd0a9e0b | Evgeny Safronov | 2015-05-14T17:32:20 | [Decode] Some value reader conversions. | diff --git a/src/decode.rs b/src/decode.rs
index 373534f..ccfae6b 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -950,16 +950,19 @@ use std::io::Read;
use std::result::Result;
use super::super::Marker;
-use super::super::value::Value;
+use super::super::value::{Integer, Value};
use super::{
ReadError,
... | 1 | 28 | 5 |
ec5a7cac90a3b4e1d68174d6fff33a3b31900b37 | Evgeny Safronov | 2015-05-13T21:49:54 | [Decode] Value decoder refactoring. | diff --git a/src/decode.rs b/src/decode.rs
index 1e4352e..373534f 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -941,52 +941,40 @@ pub fn read_ext_meta<R>(rd: &mut R) -> Result<ExtMeta, ValueReadError>
Ok(meta)
}
-/// TODO: Markdown.
/// Contains: owned value decoding, owned error; owned result.
-//pub mod... | 5 | 132 | 145 |
447ae1b740fd8325fb8d6a14f912f8e8236b3c79 | Evgeny Safronov | 2015-05-13T20:31:37 | [Value] ValueRef prototype. | diff --git a/src/value.rs b/src/value.rs
index 7205e70..94e1816 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -34,3 +34,26 @@ pub enum Value {
/// array where type information is an integer whose meaning is defined by applications.
Ext(i8, Vec<u8>),
}
+
+#[derive(Clone, Debug, PartialEq)]
+pub enum ValueRe... | 1 | 23 | 0 |
1f2de54c44a6fe72f7d9bba2f2f2b4d1d746bc30 | Evgeny Safronov | 2015-05-13T20:31:25 | [CC] Dead code elimination. | diff --git a/src/decode.rs b/src/decode.rs
index 711ae1c..1e4352e 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -941,25 +941,6 @@ pub fn read_ext_meta<R>(rd: &mut R) -> Result<ExtMeta, ValueReadError>
Ok(meta)
}
-///////////////////////////////////////////////////////////////////////////////////////////////... | 1 | 0 | 20 |
e971d095273d086af2828b2531b22f156ee0e281 | Evgeny Safronov | 2015-05-13T20:25:23 | [Misc] Minor code style. | diff --git a/src/value.rs b/src/value.rs
index 4b57635..7205e70 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -31,6 +31,6 @@ pub enum Value {
/// Map represents key-value pairs of objects.
Map(Vec<(Value, Value)>),
/// Extended implements Extension interface: represents a tuple of type information and ... | 1 | 1 | 1 |
338ab27ae04c2bc14132b283d896ebe1c24fd040 | Evgeny Safronov | 2015-05-13T20:24:23 | [Value] Defined value type close to the spec. | diff --git a/src/value.rs b/src/value.rs
index 7e6eaa3..4b57635 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -6,10 +6,31 @@ pub enum Integer {
I64(i64),
}
+#[derive(Clone, Debug, PartialEq)]
+pub enum Float {
+ F32(f32),
+ F64(f64),
+}
+
#[derive(Clone, Debug, PartialEq)]
pub enum Value {
- Null,
... | 1 | 22 | 1 |
c1a83dd9fc0cd583c6fae23b944caac0716aa70e | Evgeny Safronov | 2015-05-13T20:10:24 | [Common] Reexports cleanup. | diff --git a/src/encode.rs b/src/encode.rs
index 1dfb27c..07a4a75 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -213,7 +213,7 @@ make_write_data_fn!(f64, write_data_f64, write_f64);
///
/// # Examples
/// ```
-/// use msgpack::write_u8;
+/// use msgpack::encode::write_u8;
///
/// let mut buf = [0x00, 0x00];
/... | 2 | 2 | 8 |
f6cfd9f19c06b8993be7ad51f85f2e90aae86529 | Evgeny Safronov | 2015-05-13T20:08:56 | [Common] Mod elimination. | diff --git a/src/marker.rs b/src/init.rs
similarity index 100%
rename from src/marker.rs
rename to src/init.rs
diff --git a/src/lib.rs b/src/lib.rs
index bf0aade..d8772a5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,7 +7,7 @@ extern crate rustc_serialize as serialize;
pub const MSGPACK_VERSION : u32 = 5;
-pub us... | 2 | 2 | 2 |
99239166b674c9903042ee097f98468bc246aaa3 | Evgeny Safronov | 2015-05-13T20:03:04 | [Misc] Minor cleanup. | diff --git a/src/bench.rs b/src/bench.rs
index 774950f..66af4bc 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -1,8 +1,3 @@
-extern crate test;
-
-use super::decode::*;
-use self::test::Bencher;
-
#[bench]
fn from_i64_read_i64_loosely(b: &mut Bencher) {
let buf = [0xd3, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,... | 5 | 20 | 26 |
3eb1ae039a9aa25e3e7033e5c19b18c32d7e3164 | Evgeny Safronov | 2015-05-13T19:57:23 | [Common] Demoduling. | diff --git a/src/bench.rs b/src/bench.rs
index e3bb99d..774950f 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -1,6 +1,6 @@
extern crate test;
-use super::core::decode::*;
+use super::decode::*;
use self::test::Bencher;
#[bench]
diff --git a/src/core/decode.rs b/src/decode.rs
similarity index 99%
rename from sr... | 19 | 34 | 62 |
92151e9ccf7f073d17b92b7fa2db438f8e801893 | Evgeny Safronov | 2015-05-13T08:05:49 | [Decode] At long last, dev module has been merged. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 887f608..b174136 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -1,5 +1,3 @@
-pub mod new {
-
use std::io;
use std::io::{Read, Cursor};
use std::result::Result;
@@ -708,7 +706,7 @@ pub fn read_str_len<R>(rd: &mut R) -> Result<u32, ValueReadError... | 16 | 153 | 551 |
074ec2ae7b199e161852a136ea6684ae0c856e94 | Evgeny Safronov | 2015-05-13T07:46:23 | [Decode] Ext decoders refactoring. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 335b350..887f608 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -830,6 +830,119 @@ pub fn read_bin_borrow(rd: &[u8]) -> Result<&[u8], ValueReadError> {
}
}
+// TODO: Docs.
+pub fn read_fixext1<R>(rd: &mut R) -> Result<(i8, u8), ValueReadErr... | 3 | 238 | 238 |
83e00a60b55807b838129126dc065a8ae6a5f134 | Evgeny Safronov | 2015-05-13T07:41:17 | [Decode] Refactoring over float & bin decoders. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 2fdf161..335b350 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -247,8 +247,8 @@ make_read_data_fn!(i8, read_data_i8, read_i8);
make_read_data_fn!(i16, read_data_i16, read_i16);
make_read_data_fn!(i32, read_data_i32, read_i32);
make_read_data_... | 7 | 259 | 216 |
40f0457469dece06508c41f161e4b184f980a67a | Evgeny Safronov | 2015-05-13T05:57:28 | [UT] Oops, forgot to compile tests. | diff --git a/tests/func/decode/array.rs b/tests/func/decode/array.rs
index 71f139c..780aa20 100644
--- a/tests/func/decode/array.rs
+++ b/tests/func/decode/array.rs
@@ -1,5 +1,6 @@
use std::io::Cursor;
+use msgpack::Marker;
use msgpack::decode::new::*;
#[test]
diff --git a/tests/func/decode/map.rs b/tests/func/d... | 3 | 4 | 0 |
22a975c19011cd9b6e957672ff369b013871d38b | Evgeny Safronov | 2015-05-13T05:56:35 | [Decode] Dealing with array/map size decoders. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index c19cf20..2fdf161 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -722,7 +722,7 @@ fn read_str_data<'r, R>(rd: &mut R, len: u32, buf: &'r mut[u8]) -> Result<&'r st
/// Attempts to read and decode a string value from the reader, returning a borrowe... | 5 | 193 | 143 |
4419fc8bc0a3079c3b4bcdb443927cce5fccd268 | Evgeny Safronov | 2015-05-13T05:40:48 | [Decode] Refactoring over borrowed string decoder. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index f210a53..c19cf20 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -720,6 +720,16 @@ fn read_str_data<'r, R>(rd: &mut R, len: u32, buf: &'r mut[u8]) -> Result<&'r st
}
}
+/// Attempts to read and decode a string value from the reader, returnin... | 3 | 20 | 20 |
0e6db251cb1c88a7f999760ff66bd912a19892eb | Evgeny Safronov | 2015-05-13T05:36:42 | [Decode] Refactoring over string decoders. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index e4929bb..f210a53 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -1,8 +1,9 @@
pub mod new {
use std::io;
-use std::io::Read;
+use std::io::{Read, Cursor};
use std::result::Result;
+use std::str::{from_utf8, Utf8Error};
use byteorder;
use by... | 4 | 346 | 245 |
c28e891b7b52bc65c3d1fe9aa78450ebd5d0c49d | Evgeny Safronov | 2015-05-12T22:21:20 | [Decode] Continue with loosely decoding. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 5dd3b10..e4929bb 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -491,6 +491,115 @@ pub fn read_u64_loosely<R>(rd: &mut R) -> Result<u64, ValueReadError>
}
}
+/// Attempts to read up to 2 bytes from the given reader and to decode them as `i8... | 3 | 199 | 90 |
419c501f78e6bd8698bb0efecd4e0862a035200f | Evgeny Safronov | 2015-05-12T22:13:10 | [Decode] Refactoring over decoding loosely readers. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 94f66af..5dd3b10 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -382,6 +382,115 @@ pub fn read_i64<R>(rd: &mut R) -> Result<i64, ValueReadError>
}
}
+/// Attempts to read up to 2 bytes from the given reader and to decode them as `u8` value.... | 2 | 246 | 126 |
5cc603e89c87baceafcc80bdafd4c6e050cc4167 | Evgeny Safronov | 2015-05-12T21:54:46 | [Misc] Dead docs elimination. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index bacc4d6..94f66af 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -460,14 +460,6 @@ fn read_marker_<R>(rd: &mut R) -> result::Result<Marker, MarkerReadError>
}
}
-/// Attempts to read and decode a nil value from the given reader.
-///
-/// Ac... | 1 | 0 | 9 |
7df6146ab835cb6ef24f86ef1549eca04a6715e8 | Evgeny Safronov | 2015-05-12T21:54:01 | [Decode] Refactoring over decoding i16/32/64. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 003a5b5..bacc4d6 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -216,9 +216,9 @@ make_read_data_fn!(u16, read_data_u16, read_u16);
make_read_data_fn!(u32, read_data_u32, read_u32);
make_read_data_fn!(u64, read_data_u64, read_u64);
make_read_data... | 3 | 189 | 147 |
52a90715fe819e6c77088aab012faea7a238ae33 | Evgeny Safronov | 2015-05-12T21:47:13 | [Decode] Refactoring over decoding i8. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index cdd9a4d..003a5b5 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -215,7 +215,7 @@ make_read_data_fn!(u8, read_data_u8, read_u8);
make_read_data_fn!(u16, read_data_u16, read_u16);
make_read_data_fn!(u32, read_data_u32, read_u32);
make_read_data_... | 3 | 63 | 49 |
0d726d1aa9fe65e9ece01c724fadd9e2b3f771ca | Evgeny Safronov | 2015-05-12T21:43:52 | [Decode] Dead code elimination. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 6083acf..cdd9a4d 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -408,26 +408,6 @@ pub fn read_bool_deprecated<R>(rd: &mut R) -> result::Result<bool, FixedValueRea
}
}
-/// Tries to decode an exactly positive fixnum from the reader.
-pub fn ... | 1 | 0 | 20 |
f7507fdcf97bf547c346618cdbd42058b85d3095 | Evgeny Safronov | 2015-05-12T21:43:12 | [Decode] Read u32/64 refactoring. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 42938ef..6083acf 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -213,8 +213,8 @@ macro_rules! make_read_data_fn {
make_read_data_fn!(u8, read_data_u8, read_u8);
make_read_data_fn!(u16, read_data_u16, read_u16);
-//make_read_data_fn!(u32, read... | 3 | 53 | 37 |
421b56c7b6c6c306af06d84354b0bea365cd7846 | Evgeny Safronov | 2015-05-12T21:38:40 | [Decode] Dead code elimination. | diff --git a/src/core/decode.rs b/src/core/decode.rs
index 5e7d414..42938ef 100644
--- a/src/core/decode.rs
+++ b/src/core/decode.rs
@@ -428,28 +428,6 @@ pub fn read_i64<R>(rd: &mut R) -> Result<i64>
}
}
-/// Tries to read exactly 2 bytes from the reader and decode them as u8.
-pub fn read_u8<R>(rd: &mut R) -> ... | 1 | 0 | 22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.