about summary refs log tree commit diff
path: root/src/libserialize/json.rs
AgeCommit message (Collapse)AuthorLines
2014-09-23Deal with the fallout of string stabilizationAlex Crichton-11/+11
2014-09-19Add enum variants to the type namespaceNick Cameron-52/+53
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-17rollup merge of #17276 : treeman/json-commaAlex Crichton-2/+10
2014-09-16Fallout from renamingAaron Turon-4/+4
2014-09-15json: Properly handle trailing comma error in object decoding.Jonas Hietala-2/+10
Closes #16945
2014-09-09Decoding json now defaults Option<_> to None.Jonas Hietala-1/+37
Closes #12794
2014-09-03Fix spelling errors and capitalization.Joseph Crail-1/+1
2014-08-30Unify non-snake-case lints and non-uppercase statics lintsP1start-1/+1
This unifies the `non_snake_case_functions` and `uppercase_variables` lints into one lint, `non_snake_case`. It also now checks for non-snake-case modules. This also extends the non-camel-case types lint to check type parameters, and merges the `non_uppercase_pattern_statics` lint into the `non_uppercase_statics` lint. Because the `uppercase_variables` lint is now part of the `non_snake_case` lint, all non-snake-case variables that start with lowercase characters (such as `fooBar`) will now trigger the `non_snake_case` lint. New code should be updated to use the new `non_snake_case` lint instead of the previous `non_snake_case_functions` and `uppercase_variables` lints. All use of the `non_uppercase_pattern_statics` should be replaced with the `non_uppercase_statics` lint. Any code that previously contained non-snake-case module or variable names should be updated to use snake case names or disable the `non_snake_case` lint. Any code with non-camel-case type parameters should be changed to use camel case or disable the `non_camel_case_types` lint. [breaking-change]
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-2/+2
2014-08-21Parameterize indent in PrettyEncoderAustin Bonander-18/+85
2014-08-20auto merge of #16621 : tshepang/rust/grammar, r=steveklabnikbors-1/+1
2014-08-20doc: grammar fixesTshepang Lekhonkhobe-1/+1
2014-08-19Don't fail if an object is keyed with a string and we're expecting a numberErick Tryzelaar-2/+24
2014-08-19serialize: add json bounds checks, support for u64s, and testsErick Tryzelaar-142/+266
2014-08-19serialize: add json::{Integer,Floating} to parse large integers properlyErick Tryzelaar-107/+200
[breaking-change]
2014-08-11Reenable ignored test and add run-pass test.Luqman Aden-1/+0
2014-07-31libserialize: add `error()` to `Decoder`Andrew Poelstra-0/+5
A quick and dirty fix for #15036 until we get serious decoder reform. Right now it is impossible for a Decodable to signal a decode error, for example if it has only finitely many allowed values, is a string which must be encoded a certain way, needs a valid checksum, etc. For example in the libuuid implementation of Decodable an Option is unwrapped, meaning that a decode of a malformed UUID will cause the task to fail. Since this adds a method to the `Decoder` trait, all users will need to update their implementations to add it. The strategy used for the current implementations for JSON and EBML is to add a new entry to the error enum `ApplicationError(String)` which stores the string provided to `.error()`. [breaking-change]
2014-07-29serialize: fix a warningErick Tryzelaar-1/+1
2014-07-18Ignore one test.Luqman Aden-0/+1
2014-07-17auto merge of #15675 : errordeveloper/rust/json_docs, r=steveklabnikbors-16/+71
- add one simple example of using `ToJson` trait - make example code more readable
2014-07-17deprecate Vec::getNick Cameron-1/+1
2014-07-16Improve docs on JSON.Ilya Dmitrichenko-16/+71
- add one simple example of using `ToJson` trait - make example code more readable
2014-07-15Deprecate `str::from_utf8_owned`Adolfo Ochagavía-11/+9
Use `String::from_utf8` instead [breaking-change]
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-20/+20
[breaking-change]
2014-07-05auto merge of #15419 : erickt/rust/json, r=pcwaltonbors-37/+87
This speeds up json serialization by removing most of the allocations.
2014-07-04serialize: speed up json pretty printing by batch writing spacesErick Tryzelaar-4/+13
2014-07-04serialize: escaping json strings should write in batches.Erick Tryzelaar-15/+31
This significantly speeds up encoding json strings.
2014-07-04serialize: Remove allocations from escaping strs and indenting spacesErick Tryzelaar-38/+63
2014-07-04librustc: Remove the `&LIFETIME EXPR` production from the language.Patrick Walton-1/+1
This was parsed by the parser but completely ignored; not even stored in the AST! This breaks code that looks like: static X: &'static [u8] = &'static [1, 2, 3]; Change this code to the shorter: static X: &'static [u8] = &[1, 2, 3]; Closes #15312. [breaking-change]
2014-06-30Implement ToJson for all tuplesAdolfo Ochagavía-14/+26
2014-06-30Fix JSON documentationAdolfo Ochagavía-127/+40
Fixed some errors, removed some code examples and added usage of the `encode` and `decode` functions.
2014-06-30Implement FromStr for JsonAdolfo Ochagavía-3/+13
2014-06-30Add `encode` and `decode` shortcut functionsAdolfo Ochagavía-61/+49
Now you can just use `json::encode` and `json::decode`, which is very practical **Deprecated `Encoder::str_encode` in favor of `json::encode`** [breaking-change]
2014-06-30Removed unnecessary BoxAdolfo Ochagavía-7/+7
2014-06-30JSON cleanupAdolfo Ochagavía-263/+184
* Tried to make the code more idiomatic * Renamed the `wr` field of the `Encoder` and `PrettyEncoder` structs to `writer` * Replaced some `from_utf8` by `from_utf8_owned` to avoid unnecessary allocations * Removed unnecessary `unsafe` code
2014-06-29Implement RFC#28: Add PartialOrd::partial_cmpSteven Fackler-57/+1
I ended up altering the semantics of Json's PartialOrd implementation. It used to be the case that Null < Null, but I can't think of any reason for an ordering other than the default one so I just switched it over to using the derived implementation. This also fixes broken `PartialOrd` implementations for `Vec` and `TreeMap`. RFC: 0028-partial-cmp
2014-06-29librustc: Remove the fallback to `int` for integers and `f64` forPatrick Walton-1/+1
floating point numbers for real. This will break code that looks like: let mut x = 0; while ... { x += 1; } println!("{}", x); Change that code to: let mut x = 0i; while ... { x += 1; } println!("{}", x); Closes #15201. [breaking-change]
2014-06-26json: Fix handling of NaN/Infinitymrec-6/+51
The JSON spec requires that these special values be serialized as null; the current serialization breaks any conformant JSON parser. So encoding needs to output "null", to_json on floating-point types can return Null as well as Number, and reading null when specifically expecting a number should be interpreted as NaN. There's no way to round-trip Infinity.
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-10/+10
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-21serialize: Simplify the json docsErick Tryzelaar-1/+1
2014-06-18Remove TraitStore from ty_traitNick Cameron-7/+14
Use ty_rptr/ty_uniq(ty_trait) rather than TraitStore to represent trait types. Also addresses (but doesn't close) #12470. Part of the work towards DST (#12938). [breaking-change] lifetime parameters in `&mut trait` are now invariant. They used to be contravariant.
2014-06-16Update "use" to "uses" ln186theptrk-1/+1
2014-06-16auto merge of #14932 : Sawyer47/rust/json-smallfix, r=huonwbors-5/+1
2014-06-15Register new snapshotsAlex Crichton-68/+0
2014-06-15Small improvement for json PrettyEncoderPiotr Jawniak-5/+1
2014-06-13auto merge of #14831 : alexcrichton/rust/format-intl, r=brsonbors-0/+68
* The select/plural methods from format strings are removed * The # character no longer needs to be escaped * The \-based escapes have been removed * '{{' is now an escape for '{' * '}}' is now an escape for '}' Closes #14810 [breaking-change]
2014-06-11std: Remove i18n/l10n from format!Alex Crichton-0/+68
* The select/plural methods from format strings are removed * The # character no longer needs to be escaped * The \-based escapes have been removed * '{{' is now an escape for '{' * '}}' is now an escape for '}' Closes #14810 [breaking-change]
2014-06-11rustc: Remove ~[T] from the languageAlex Crichton-91/+89
The following features have been removed * box [a, b, c] * ~[a, b, c] * box [a, ..N] * ~[a, ..N] * ~[T] (as a type) * deprecated_owned_vector lint All users of ~[T] should move to using Vec<T> instead.
2014-06-08Fix spelling errors in comments.Joseph Crail-3/+3
2014-06-05Fallout from the libcollections movementAlex Crichton-14/+8