rust/src/libserialize
Alex Crichton b78b749810 Remove all ToStr impls, add Show impls
This commit changes the ToStr trait to:

    impl<T: fmt::Show> ToStr for T {
        fn to_str(&self) -> ~str { format!("{}", *self) }
    }

The ToStr trait has been on the chopping block for quite awhile now, and this is
the final nail in its coffin. The trait and the corresponding method are not
being removed as part of this commit, but rather any implementations of the
`ToStr` trait are being forbidden because of the generic impl. The new way to
get the `to_str()` method to work is to implement `fmt::Show`.

Formatting into a `&mut Writer` (as `format!` does) is much more efficient than
`ToStr` when building up large strings. The `ToStr` trait forces many
intermediate allocations to be made while the `fmt::Show` trait allows
incremental buildup in the same heap allocated buffer. Additionally, the
`fmt::Show` trait is much more extensible in terms of interoperation with other
`Writer` instances and in more situations. By design the `ToStr` trait requires
at least one allocation whereas the `fmt::Show` trait does not require any
allocations.

Closes #8242
Closes #9806
2014-02-23 20:51:56 -08:00
..
base64.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
ebml.rs Warn about unnecessary parentheses upon assignment 2014-02-22 16:32:48 +01:00
hex.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
lib.rs move extra::test to libtest 2014-02-20 16:03:58 +08:00
serialize.rs Move std::{trie, hashmap} to libcollections 2014-02-23 00:35:11 -08:00