about summary refs log tree commit diff
path: root/src/libserialize
AgeCommit message (Collapse)AuthorLines
2014-06-11rustc: Update how Gc<T> is recognizedAlex Crichton-4/+5
This commit uses the same trick as ~/Box to map Gc<T> to @T internally inside the compiler. This moves a number of implementations of traits to the `gc` module in the standard library. This removes functions such as `Gc::new`, `Gc::borrow`, and `Gc::ptr_eq` in favor of the more modern equivalents, `box(GC)`, `Deref`, and pointer equality. The Gc pointer itself should be much more useful now, and subsequent commits will move the compiler away from @T towards Gc<T> [breaking-change]
2014-06-09Use phase(plugin) in bootstrap cratesKeegan McAllister-0/+6
Do this to avoid warnings on post-stage0 builds.
2014-06-08Fix spelling errors in comments.Joseph Crail-3/+3
2014-06-06rustdoc: Submit examples to play.rust-lang.orgAlex Crichton-1/+2
This grows a new option inside of rustdoc to add the ability to submit examples to an external website. If the `--markdown-playground-url` command line option or crate doc attribute `html_playground_url` is present, then examples will have a button on hover to submit the code to the playground specified. This commit enables submission of example code to play.rust-lang.org. The code submitted is that which is tested by rustdoc, not necessarily the exact code shown in the example. Closes #14654
2014-06-05Fallout from the libcollections movementAlex Crichton-19/+11
2014-06-03Implement ToJson for &[T], and add tests. Closes #14619Jorge Aparicio-0/+54
2014-06-01std: Drop Total from Total{Eq,Ord}Alex Crichton-8/+8
This completes the last stage of the renaming of the comparison hierarchy of traits. This change renames TotalEq to Eq and TotalOrd to Ord. In the future the new Eq/Ord will be filled out with their appropriate methods, but for now this change is purely a renaming change. [breaking-change]
2014-05-30std: Rename {Eq,Ord} to Partial{Eq,Ord}Alex Crichton-18/+18
This is part of the ongoing renaming of the equality traits. See #12517 for more details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord} or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}. cc #12517 [breaking-change]
2014-05-30lib{serialize, uuid}: Fix snake case errors.Kevin Butler-20/+22
A number of functions/methods have been moved or renamed to align better with rust standard conventions. serialize::ebml::reader::Doc => seriaize::ebml::Doc::new serialize::ebml::reader::Decoder => Decoder::new serialize::ebml::writer::Encoder => Encoder::new [breaking-change]
2014-05-29std: Recreate a `rand` moduleAlex Crichton-2/+1
This commit shuffles around some of the `rand` code, along with some reorganization. The new state of the world is as follows: * The librand crate now only depends on libcore. This interface is experimental. * The standard library has a new module, `std::rand`. This interface will eventually become stable. Unfortunately, this entailed more of a breaking change than just shuffling some names around. The following breaking changes were made to the rand library: * Rng::gen_vec() was removed. This has been replaced with Rng::gen_iter() which will return an infinite stream of random values. Previous behavior can be regained with `rng.gen_iter().take(n).collect()` * Rng::gen_ascii_str() was removed. This has been replaced with Rng::gen_ascii_chars() which will return an infinite stream of random ascii characters. Similarly to gen_iter(), previous behavior can be emulated with `rng.gen_ascii_chars().take(n).collect()` * {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all relied on being able to use an OSRng for seeding, but this is no longer available in librand (where these types are defined). To retain the same functionality, these types now implement the `Rand` trait so they can be generated with a random seed from another random number generator. This allows the stdlib to use an OSRng to create seeded instances of these RNGs. * Rand implementations for `Box<T>` and `@T` were removed. These seemed to be pretty rare in the codebase, and it allows for librand to not depend on liballoc. Additionally, other pointer types like Rc<T> and Arc<T> were not supported. If this is undesirable, librand can depend on liballoc and regain these implementations. * The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`, but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice structure now has a lifetime associated with it. * The `sample` method on `Rng` has been moved to a top-level function in the `rand` module due to its dependence on `Vec`. cc #13851 [breaking-change]
2014-05-28std: Remove format_strbuf!()Alex Crichton-29/+20
This was only ever a transitionary macro.
2014-05-27Move std::{reflect,repr,Poly} to a libdebug crateAlex Crichton-12/+13
This commit moves reflection (as well as the {:?} format modifier) to a new libdebug crate, all of which is marked experimental. This is a breaking change because it now requires the debug crate to be explicitly linked if the :? format qualifier is used. This means that any code using this feature will have to add `extern crate debug;` to the top of the crate. Any code relying on reflection will also need to do this. Closes #12019 [breaking-change]
2014-05-27auto merge of #14414 : richo/rust/features/nerf_unused_string_fns, ↵bors-151/+151
r=alexcrichton This should block on #14323
2014-05-27std: Rename strbuf operations to stringRicho Healey-151/+151
[breaking-change]
2014-05-27serialize: Remove old commented out codeErick Tryzelaar-30/+0
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-64/+64
[breaking-change]
2014-05-24Removed unnecessary macro declarationAdolfo Ochagavía-4/+0
2014-05-22auto merge of #14348 : alexcrichton/rust/doc.rust-lang.org, r=huonwbors-1/+1
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-3/+11
[breaking-change]
2014-05-22libstd: Remove all uses of `~str` from `libstd`Patrick Walton-3/+9
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-2/+2
2014-05-21Change static.rust-lang.org to doc.rust-lang.orgAlex Crichton-1/+1
The new documentation site has shorter urls, gzip'd content, and index.html redirecting functionality.
2014-05-16libserialize: Remove all uses of `~str` from `libserialize`.Patrick Walton-255/+291
Had to make `struct Tm` in `libtime` not serializable for now.
2014-05-15Updates with core::fmt changesAlex Crichton-5/+5
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-15auto merge of #14213 : kballard/rust/str_from_utf8_result, r=cmrbors-7/+5
Change `str::from_utf8_owned()` and `StrBuf::from_utf8()` to return `Result`. This allows the vector to be recovered when it contains invalid UTF-8.
2014-05-14Change StrBuf::from_utf8() to return ResultKevin Ballard-7/+5
This allows the original vector to be recovered in the event that it is not UTF-8. [breaking-change]
2014-05-13serialize: Broaden ignores of json testsAlex Crichton-2/+2
It was thought that these failures only happened on windows, turns out they happen on any 32-bit machine. cc #14064
2014-05-12Add the patch number to version strings. Closes #13289Brian Anderson-1/+1
2014-05-11core: Remove the cast moduleAlex Crichton-7/+7
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-09auto merge of #14065 : alexcrichton/rust/ignore-flaky-windows-test, r=brsonbors-0/+2
See #14064 for some rationale, but the basic idea is that I suspect that there is an LLVM codegen bug somewhere, and I'm not entirely sure why it's happening intermittently rather than deterministically... cc #14064
2014-05-09serialize: Ignore two flaky json tests on windowsAlex Crichton-0/+2
See #14064 for some rationale, but the basic idea is that I suspect that there is an LLVM codegen bug somewhere, and I'm not entirely sure why it's happening intermittently rather than deterministically... cc #14064
2014-05-08Restore Decodable impl for ~[T]Kevin Ballard-0/+15
Bring back the Decodable impl for ~[T], this time using FromVec. It's still not recommended that anyone use this, but at least it's available if necessary.
2014-05-08Handle fallout in documentationKevin Ballard-4/+4
Tweak the tutorial's section on vectors and strings, to slightly clarify the difference between fixed-size vectors, vectors, and slices.
2014-05-08Handle fallout in libserializeKevin Ballard-88/+73
API Changes: - from_base64() returns Result<Vec<u8>, FromBase64Error> - from_hex() returns Result<Vec<u8>, FromHexError> - json::List is a Vec<Json> - Decodable is no longer implemented on ~[T] (but Encodable still is) - DecoderHelpers::read_to_vec() returns a Result<Vec<T>, E>
2014-05-07core: Inherit non-allocating slice functionalityAlex Crichton-1/+0
This commit adds a new trait, MutableVectorAllocating, which represents functions on vectors which can allocate. This is another extension trait to slices which should be removed once a lang item exists for the ~ allocation.
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-11/+10
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-03auto merge of #13773 : brson/rust/boxxy, r=alexcrichtonbors-64/+64
`box` is the way you allocate in future-rust.
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-64/+64
2014-05-02Implement ToJson for Vec<T>Herman J. Radtke III-0/+4
Now that ~[T] is obsolete, we need to allow to_json() to work for vectors.
2014-05-01auto merge of #13886 : japaric/rust/fix-an-typos, r=alexcrichtonbors-2/+2
Found the first one in the rust reference docs. I was going to submit a PR with one fix, but figured I could look for more... This is the result.
2014-05-01Fix a/an typosJorge Aparicio-2/+2
2014-05-01auto merge of #13877 : thestinger/rust/de-tilde-str-vec, r=alexcrichtonbors-20/+20
2014-05-01remove leftover obsolete string literalsDaniel Micay-19/+19
2014-04-30Add serialization support for StrBufHerman J. Radtke III-35/+35
- implement Encodable and Decodable for StrBuf - implement to_json for StrBuf
2014-04-30librustc: Remove `~"string"` and `&"string"` from the languagePatrick Walton-1/+1
2014-04-30auto merge of #13648 : gereeter/rust/removed-rev, r=alexcrichtonbors-2/+2
In the process, `Splits` got changed to be more like `CharSplits` in `str` to present the DEI interface. Note that `treemap` still has a `rev_iter` function because it seems like it would be a significant interface change to expose a DEI - the iterator would have to gain an extra pointer, the completion checks would be more complicated, and it isn't easy to check that such an implementation is correct due to the use of unsafety to subvert the aliasing properties of `&mut`. This fixes #9391.
2014-04-28Deprecate the rev_iter pattern in all places where a DoubleEndedIterator is ↵Jonathan S-2/+2
provided (everywhere but treemap) This commit deprecates rev_iter, mut_rev_iter, move_rev_iter everywhere (except treemap) and also deprecates related functions like rsplit, rev_components, and rev_str_components. In every case, these functions can be replaced with the non-reversed form followed by a call to .rev(). To make this more concrete, a translation table for all functional changes necessary follows: * container.rev_iter() -> container.iter().rev() * container.mut_rev_iter() -> container.mut_iter().rev() * container.move_rev_iter() -> container.move_iter().rev() * sliceorstr.rsplit(sep) -> sliceorstr.split(sep).rev() * path.rev_components() -> path.components().rev() * path.rev_str_components() -> path.str_components().rev() In terms of the type system, this change also deprecates any specialized reversed iterator types (except in treemap), opting instead to use Rev directly if any type annotations are needed. However, since methods directly returning reversed iterators are now discouraged, the need for such annotations should be small. However, in those cases, the general pattern for conversion is to take whatever follows Rev in the original reversed name and surround it with Rev<>: * RevComponents<'a> -> Rev<Components<'a>> * RevStrComponents<'a> -> Rev<StrComponents<'a>> * RevItems<'a, T> -> Rev<Items<'a, T>> * etc. The reasoning behind this change is that it makes the standard API much simpler without reducing readability, performance, or power. The presence of functions such as rev_iter adds more boilerplate code to libraries (all of which simply call .iter().rev()), clutters up the documentation, and only helps code by saving two characters. Additionally, the numerous type synonyms that were used to make the type signatures look nice like RevItems add even more boilerplate and clutter up the docs even more. With this change, all that cruft goes away. [breaking-change]
2014-04-27Fix a code formatting issue in json.rsNicolas Silva-1/+2
2014-04-27Add a streaming parser to serialize::json.Nicolas Silva-261/+1048
2014-04-19serialize: Remove errant println!'s from decodeRicho Healey-3/+0