Commit Graph

743 Commits

Author SHA1 Message Date
Hugo Duncan
a935ebe8b9 Adds serializer format specific field names
Allows different field names to be used for different external formats.

Field names are specified using the `rename` field attribute, e.g:

    #[serde(rename(xml= "a4", json="a5"))]

Reverts #62

Addresses #61
2015-05-08 12:43:11 -04:00
Oliver Schneider
83ee86122b address comments by erickt 2015-05-08 16:32:46 +02:00
Erick Tryzelaar
af752ddcb5 Merge pull request #71 from lifthrasiir/json-split-branch
Replace a redundant `escape` variable with nested matches.
2015-05-07 10:51:57 -07:00
Kang Seonghoon
9550063275 Replace a redundant escape variable with nested matches.
This has a non-trivial performance effect due to the branch prediction,
but is expected to be no slower than the older code and, at least in
some cases, is slightly faster for a string-heavy JSON.
2015-05-08 01:53:24 +09:00
Oliver Schneider
c117a680cf changes needed for xml parsing 2015-05-04 16:07:19 +02:00
Erick Tryzelaar
206e19edb4 Fix unquoting arms with latest quasi 2015-05-02 10:44:57 -07:00
Erick Tryzelaar
f0c87fbd4c Format flats with Debug to properly print "-0.0". 2015-05-01 07:43:48 -07:00
Erick Tryzelaar
c3fe6c9c67 Update the README to point at https://github.com/serde-rs 2015-04-26 18:37:18 -07:00
Erick Tryzelaar
e5df4b6653 Simplify PrettyFormatter::new 2015-04-26 12:05:38 -07:00
Erick Tryzelaar
12cf2f0b0b Simplify the return types 2015-04-26 11:01:55 -07:00
Erick Tryzelaar
8d4de2b3db Rename Serializer::new_with_formatter to with_formatter 2015-04-26 10:29:28 -07:00
Erick Tryzelaar
e509adcac5 Allow the pretty printer character to be changed
This unfortunately loses the simd-ish whitespace printer, but since
pretty printing shouldn't be on a hot path, this shouldn't really
matter.

Partially addresses #65.
2015-04-26 09:29:06 -07:00
Erick Tryzelaar
eb9c860cb4 Rename iterator.rs to iter.rs and expose it. 2015-04-26 09:23:08 -07:00
Erick Tryzelaar
cf38b8dae5 Add some docs to LineColIterator, expose the underlying iterator 2015-04-26 09:22:56 -07:00
Erick Tryzelaar
75af81234f LineColIterator doesn't need to be peekable. 2015-04-26 09:21:52 -07:00
Erick Tryzelaar
7cc319acca Bump version to 0.3.2. 2015-04-26 09:21:26 -07:00
Erick Tryzelaar
3b44792ff3 Merge pull request #64 from oli-obk/missing_renamed_field
missing field errors displayed original field name instead of renamed
2015-04-26 08:09:00 -07:00
Erick Tryzelaar
678bad241e Merge pull request #66 from daniellandau/fix/compilation
Fix compilation for latest nightly
2015-04-25 08:13:39 -07:00
Daniel Landau
5b1225cc87 Fix compilation for latest nightly 2015-04-24 22:35:56 +03:00
Oliver Schneider
1748831152 missing field errors displayed original field name instead of renamed
closes #63
2015-04-23 17:28:42 +02:00
Erick Tryzelaar
ed1b476a22 Merge pull request #58 from oli-obk/separate_line_col
separate out the line/column counting from character iteration
2015-04-22 11:02:55 -07:00
Erick Tryzelaar
79c59ebae1 Merge pull request #62 from hugoduncan/add-ser-de-rename
Add serialize, deserialize specific rename
2015-04-22 11:01:38 -07:00
Hugo Duncan
fd6462f8d1 Add serialize, deserialize specific rename
Adds the rename_serialize and rename_deserialize field attributes to
specify serialisation and deserialisation specific renames.
2015-04-21 17:58:18 -04:00
Oliver Schneider
c37f67b0a1 separate out the line/column counting from character iteration 2015-04-16 16:31:56 +02:00
Erick Tryzelaar
195f7380b5 Merge pull request #56 from derhaskell/patch-1
fixes struct serialization example for rust 1.0.0-beta
2015-04-13 06:21:37 -07:00
derhaskell
becb8c48e8 fixes typo in deserialization example 2015-04-13 13:37:06 +02:00
derhaskell
aa16ecf4d3 Update README.md 2015-04-13 13:28:47 +02:00
derhaskell
ddda360fec Update README.md
fixes struct serialization example for rust 1.0.0-beta
2015-04-13 13:27:15 +02:00
Erick Tryzelaar
cca72f2dbc Merge pull request #55 from sfackler/master
Add doc link to Cargo.toml and doc attr
2015-04-12 22:22:25 -07:00
Steven Fackler
5013b37c09 Add doc link to Cargo.toml and doc attr
The attribute allows cross-crate rustdoc links.
2015-04-12 22:21:00 -07:00
Erick Tryzelaar
c90dc9f48f bump version to 0.3.1 2015-04-12 11:43:35 -07:00
Erick Tryzelaar
67e8ca354c Remove core feature 2015-04-12 11:36:09 -07:00
Erick Tryzelaar
9a4ba047c4 Remove collections feature flag and disable VecMap, which is unstable 2015-04-12 10:48:32 -07:00
Erick Tryzelaar
7622255d6f Remove the std_misc feature flag 2015-04-12 10:43:29 -07:00
Erick Tryzelaar
8ba1e7aceb Remove the need for the unicode feature flag 2015-04-12 10:42:57 -07:00
Erick Tryzelaar
5f6838130d Update to Rust HEAD 2015-04-12 10:32:54 -07:00
Erick Tryzelaar
e0eff942b1 Add Error::unknown_field_error 2015-04-12 10:32:54 -07:00
Erick Tryzelaar
1da47c0870 Change de::VariantVisitor to let deserializers know the variant kind
This allows formats like cbor that encode a unit variant as just a
string to work.

[breaking-change]
2015-04-12 10:32:54 -07:00
Erick Tryzelaar
d36879f5ee Merge pull request #54 from apoelstra/no-impl-bytebuf
Remove `impl Into<Vec<u8>> for ByteBuf` since it causes a compile error
2015-04-12 10:32:36 -07:00
Andrew Poelstra
f363cb435a Remove impl Into<Vec<u8>> for ByteBuf since it causes a compile error
As BurntSushi observes, there is an `impl<T, U> Into<U> for T where U: From<T>`
in libcore. We have `From<Vec<u8>>` for `ByteBuf` since we have implemented
`From<T> for ByteBuf where T: Into<Vec<u8>>`, so this is redundant anyway.
2015-04-11 17:51:31 -05:00
Erick Tryzelaar
d8506e9a6d Update to rust HEAD 2015-04-05 13:20:33 -04:00
Erick Tryzelaar
87503d11e9 Merge pull request #49 from alexcrichton/tweak-some-impls
Tweak some Deserialize/Serialize impls
2015-04-03 12:04:50 -04:00
Erick Tryzelaar
d0b49d9b89 Finish updating to rust HEAD 2015-04-02 19:13:25 -07:00
Erick Tryzelaar
b30965ede4 Get serde to build, but tests are still failing 2015-04-02 13:27:57 -07:00
Alex Crichton
ace6d9e442 Generalize some serialization impls
* Impl Serialize for bare `str`
* Expand `&T` and `&mut T` blanket impls to include `T: ?Sized`
* Expand `Box<T>` blanket impl to include `T: ?Sized`
2015-04-02 12:54:21 -07:00
Alex Crichton
e150553d58 Add deserialize impls for smart pointers
This allows deserializing into a Box/Arc/Rc pointer
2015-04-02 12:53:51 -07:00
Erick Tryzelaar
ed569bd3f6 Update to latest rust nightly 2015-04-01 22:51:02 -07:00
Erick Tryzelaar
d00c1ad6d0 Remove the use of serde_macros from the doctests
This has been disabled in the upcoming beta.
2015-04-01 22:19:14 -07:00
Erick Tryzelaar
2cd49060fa Rename #[serde(alias)] to #[serde(rename)] and add tests
Closes #9 and #47.
2015-04-01 22:14:28 -07:00
Erick Tryzelaar
54a970e694 Remove an unnecessary import 2015-04-01 22:13:34 -07:00