Commit Graph

800 Commits

Author SHA1 Message Date
Erick Tryzelaar
764b25bd07 Have Deserializer::visit_{usize,u8,...,isize,i8,...,f32} call visit_{u64,i64,f64}
This cuts down the amount of overloading needed by a format like
toml which wants to prevent casting a float to an integer and
vice versa.
2015-08-13 08:40:19 -07:00
Erick Tryzelaar
a66cd25787 Merge pull request #135 from erickt/doc
Add a table pointing to the serializers that support serde
2015-08-11 07:02:22 -07:00
Erick Tryzelaar
0e8d94750b Add a table pointing to the serializers that support serde 2015-08-11 07:00:59 -07:00
Erick Tryzelaar
3c915189f4 version bump 2015-08-10 10:09:37 -07:00
Erick Tryzelaar
c5541cddeb Merge pull request #134 from erickt/err
Add Error::length_mismatch, Error::type_mismatch, and de::Type
2015-08-10 10:07:51 -07:00
Erick Tryzelaar
63561609a6 Add Error::length_mismatch, Error::type_mismatch, and de::Type
This improves error handling to match the needs of msgpack
2015-08-09 21:42:42 -07:00
Erick Tryzelaar
5dc356ddb0 Merge pull request #133 from erickt/fixup
Fix doc links, recover some json deserialization speed
2015-08-09 18:17:02 -07:00
Erick Tryzelaar
dc36fd38d6 Gain back 10MB/s on the json deserialization benchmark 2015-08-09 16:45:55 -07:00
Erick Tryzelaar
26873bf3d5 Don't use sudo in the travis 2015-08-09 16:40:35 -07:00
Erick Tryzelaar
ff53323790 Correct the documentation links in the crates 2015-08-09 16:38:10 -07:00
Erick Tryzelaar
fd3869d380 Update the README 2015-08-09 16:37:21 -07:00
Erick Tryzelaar
1d538bc59d Merge pull request #132 from Byron/fix-codegen
Use fully qualified `Result` type
2015-08-08 15:48:49 -07:00
Sebastian Thiel
784cfcd49e Use fully qualified Result type
If that is not the case, the generated code might attempt to use a
custom `Result` type with incompatible type parameters.
2015-08-08 12:33:29 +02:00
Erick Tryzelaar
a142d319e7 Point the serde_json readme at the root readme 2015-08-07 12:05:01 -07:00
Erick Tryzelaar
da3bf3c20a Merge pull request #130 from oli-obk/fix
json deser from Value adjusted to be equal to deser from strings
2015-08-07 09:45:37 -07:00
Erick Tryzelaar
1672306fa1 Merge pull request #129 from erickt/remove-error
Remove "_error" from de::Error methods, add string argument to Error::syntax()
2015-08-07 09:45:11 -07:00
Oliver Schneider
7fc780ba1b json deser from Value adjusted to be equal to deser from strings 2015-08-07 18:31:42 +02:00
Erick Tryzelaar
7fb2bd50bf Add a string argument to Error::syntax() 2015-08-07 08:08:56 -07:00
Erick Tryzelaar
2aeb51ad51 Remove "_error" from de::Error::*_error 2015-08-07 07:53:22 -07:00
Erick Tryzelaar
0482b756e8 Merge pull request #127 from erickt/json3
Rewrite json parser to not require consuming the full stream
2015-08-07 07:52:52 -07:00
Erick Tryzelaar
1d9c707a76 Rewrite json parser to not require consuming the full stream
Closes #89
2015-08-06 11:12:37 -07:00
Erick Tryzelaar
199ed417bd Merge pull request #126 from erickt/json-f64
Update json number parsing to switch to floats if the number gets too big
2015-08-06 10:08:31 -07:00
Erick Tryzelaar
199a02cb68 i64::wrapping_neg is not stable yet 2015-08-06 09:31:37 -07:00
Erick Tryzelaar
b6371f045f Simplify parsing a number 2015-08-06 07:12:00 -07:00
Erick Tryzelaar
fd84aec485 Fix parsing min, max, and epsilon f64 values 2015-08-05 08:15:47 -07:00
Erick Tryzelaar
ed6777e59f Fix json parsing i64::MIN, add tests for min and max i64 and u64 values 2015-08-03 09:09:44 -07:00
Erick Tryzelaar
22024a2b71 Simplify parsing floating point decimals and exponents 2015-08-01 14:26:53 -07:00
Erick Tryzelaar
8eff38b6f6 Eliminate some code duplication parsing an exponent as an integer 2015-08-01 13:50:42 -07:00
Erick Tryzelaar
fa562d449d Minor optimization to not check if JSON number starts with '-' twice 2015-08-01 13:50:24 -07:00
Erick Tryzelaar
c9d55362d6 Add a serde_json::Result helper type 2015-08-01 13:49:57 -07:00
Erick Tryzelaar
23031d057f Add test for parsing json "0" and "0.0" 2015-07-31 07:33:23 -07:00
Erick Tryzelaar
882d394352 Remove a debug comment 2015-07-31 07:28:07 -07:00
Erick Tryzelaar
fbdede68a4 Build the serde_json docs 2015-07-31 07:24:05 -07:00
Erick Tryzelaar
e88ef4715c Explicitly make the visit_struct_{,variant}_elt key a &'static str 2015-07-31 07:22:14 -07:00
Erick Tryzelaar
94f3dd25d8 Allow VariantVisitor::visit_newtype to default to calling visit_tuple 2015-07-31 07:22:13 -07:00
Erick Tryzelaar
2c58a9c11d Expose TupleVisitor*::new 2015-07-31 07:22:13 -07:00
Erick Tryzelaar
97528b59cf Add support for serializing newtype structs
This enables formats like JSON to serialize newtype wrapper
structs without the normal object wrapper. Consider types like:

```rust
struct Point {
    x: u32,
    y: u32,
}

stuct MyPoint(Point);
```

Before this patch, `MyPoint(1,2)` would get serialized as
`[{"x":1,"y":2}]`, but now it gets serialized as `{"x":1,"y"2}`.
2015-07-31 07:22:13 -07:00
Erick Tryzelaar
6715fb6652 Rename visit_simple to visit_newtype 2015-07-31 07:22:13 -07:00
Erick Tryzelaar
fefc010deb Rename visit_enum_simple to visit_newtype_variant 2015-07-31 07:22:13 -07:00
Erick Tryzelaar
6cbb72decf Inlne the visit_seq method 2015-07-31 07:22:13 -07:00
Erick Tryzelaar
7e25ed863c Merge pull request #120 from erickt/enum-fields
Add enum fields and tuple length to deserialization visitor methods, renamed some more methods
2015-07-30 09:51:01 -07:00
Erick Tryzelaar
5a56394814 Add test to deserialize variants from usize and &[u8] 2015-07-30 08:06:04 -07:00
Erick Tryzelaar
de1059f648 Allow Result<T, E> to use usize variant names 2015-07-30 08:06:04 -07:00
Erick Tryzelaar
97f08086dd Have visit_enum_simple default to calling visit_tuple_variant 2015-07-30 08:06:04 -07:00
Erick Tryzelaar
0348a3914d Pass variant index to visit_enum_simple 2015-07-30 08:06:04 -07:00
Erick Tryzelaar
5dc245d2ce Switch serializing Result to using simple enums 2015-07-30 08:06:04 -07:00
Erick Tryzelaar
71cc95248c Allow Option<T> to be used directly as a ser::SeqVisitor 2015-07-30 08:06:04 -07:00
Erick Tryzelaar
2cb7d66767 Add test for deserializing a simple enum 2015-07-30 08:06:04 -07:00
Erick Tryzelaar
49fa208242 Minor cleanup 2015-07-30 08:06:04 -07:00
Erick Tryzelaar
d2fef27721 Rename ser::Serializer::visit_enum_{unit,seq,map} to visit_{unit,tuple,struct}_variant 2015-07-30 06:45:21 -07:00