rust/src/libstd
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
..
comm auto merge of #12419 : huonw/rust/compiler-unsafe, r=alexcrichton 2014-02-21 07:06:51 -08:00
fmt Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
hash std: fix the hash doctest 2014-02-22 14:12:47 -08:00
io Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
num Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
path Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
rand move extra::test to libtest 2014-02-20 16:03:58 +08:00
rt auto merge of #12311 : brson/rust/unstable, r=alexcrichton 2014-02-23 02:21:53 -08:00
sync std: Move intrinsics to std::intrinsics. 2014-02-23 01:07:53 -08:00
unstable std: Move unstable::stack to rt::stack 2014-02-23 01:47:08 -08:00
any.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
ascii.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
bool.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
c_str.rs std: Move raw to std::raw 2014-02-23 01:07:53 -08:00
cast.rs std: Move raw to std::raw 2014-02-23 01:07:53 -08:00
cell.rs Cleaned up imports per coding standards. 2014-02-07 09:59:19 -08:00
char.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
cleanup.rs std: Move raw to std::raw 2014-02-23 01:07:53 -08:00
clone.rs 'borrowed pointer' -> 'reference' 2014-01-07 18:49:13 -08:00
cmp.rs Removed num::Orderable 2014-02-13 20:12:59 -05:00
container.rs std: uniform modules titles for doc 2013-12-27 09:49:11 +01:00
default.rs libstd: Remove all support code related to @mut 2014-01-03 14:02:00 -08:00
from_str.rs std: uniform modules titles for doc 2013-12-27 09:49:11 +01:00
gc.rs Fix @str removal tests. 2014-02-02 02:58:57 +11:00
intrinsics.rs Transition to new Hash, removing IterBytes and std::to_bytes. 2014-02-24 07:44:10 +11:00
iter.rs Move std::num::Integer to libnum 2014-02-22 01:45:29 +11:00
kinds.rs Fix all code examples 2014-02-14 23:49:22 -08:00
lib.rs Transition to new Hash, removing IterBytes and std::to_bytes. 2014-02-24 07:44:10 +11:00
libc.rs Implement named pipes for windows, touch up unix 2014-02-16 18:46:01 -08:00
local_data.rs std: Move intrinsics to std::intrinsics. 2014-02-23 01:07:53 -08:00
logging.rs Move std::{trie, hashmap} to libcollections 2014-02-23 00:35:11 -08:00
macros.rs libstd: Implement some convenience methods on vectors 2014-02-21 10:54:14 -08:00
managed.rs std: Move raw to std::raw 2014-02-23 01:07:53 -08:00
mem.rs std: Move intrinsics to std::intrinsics. 2014-02-23 01:07:53 -08:00
ops.rs move extra::test to libtest 2014-02-20 16:03:58 +08:00
option.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
os.rs Warn about unnecessary parentheses upon assignment 2014-02-22 16:32:48 +01:00
owned.rs librustc: Implement placement box for GC and unique pointers. 2014-01-09 16:05:34 -08:00
prelude.rs Transition to new Hash, removing IterBytes and std::to_bytes. 2014-02-24 07:44:10 +11:00
ptr.rs std: Move intrinsics to std::intrinsics. 2014-02-23 01:07:53 -08:00
raw.rs std: Move raw to std::raw 2014-02-23 01:07:53 -08:00
rc.rs std: clean up ptr a bit 2014-02-15 12:11:41 -05:00
reference.rs Cleaned up imports per coding standards. 2014-02-07 09:59:19 -08:00
reflect.rs std: Move raw to std::raw 2014-02-23 01:07:53 -08:00
repr.rs std: Move raw to std::raw 2014-02-23 01:07:53 -08:00
result.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
rtdeps.rs Invoke gcc with -nodefaultlibs 2014-02-14 08:07:46 -08:00
run.rs Allow configuration of uid/gid/detach on processes 2014-02-16 16:01:03 -08:00
str.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
task.rs Clean up std::task docs, make TaskBuilder a real builder 2014-02-16 15:34:02 -08:00
to_str.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
tuple.rs Remove all ToStr impls, add Show impls 2014-02-23 20:51:56 -08:00
unicode.rs Remove dead codes 2013-12-08 02:55:28 -05:00
unit.rs Add some missing Show implementations in libstd 2014-02-13 12:54:01 -08:00
vec.rs auto merge of #12311 : brson/rust/unstable, r=alexcrichton 2014-02-23 02:21:53 -08:00
vec_ng.rs std: Move raw to std::raw 2014-02-23 01:07:53 -08:00