Yes, both suggestions sound very reasonable. It would also eliminate the
need for the Str trait altogether (since the Default fmt function would
avoid the allocation). So there would really be no need for most format
specifiers, except stuff like controlling the base of integers, etc.


On Tue, Oct 1, 2013 at 9:30 AM, Huon Wilson <[email protected]> wrote:

> I think we should just replace ToStr and the #[deriving] with Default and
> a default method .to_str() on that trait, since ToStr's current design
> makes it very allocation-heavy (it has to allocate a new ~str for each
> subfield, rather than just appending to a common buffer as using the new
> format infrastructure would allow).
>
>
> Also, not directly related to this exact discussion, but we could probably
> cope with having fewer format specifiers, e.g. format!("{:b}", true) could
> just be format!("{}", true), and similarly for `c`. (and even `s` itself!)
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to