summary refs log tree commit diff
path: root/src/libstd/fmt/mod.rs
AgeCommit message (Collapse)AuthorLines
2014-03-25libstd: Document the following modules:Patrick Walton-30/+73
* native::io * std::char * std::fmt * std::fmt::parse * std::io * std::io::extensions * std::io::net::ip * std::io::net::udp * std::io::net::unix * std::io::pipe * std::num * std::num::f32 * std::num::f64 * std::num::strconv * std::os
2014-03-20rename std::vec -> std::sliceDaniel Micay-3/+3
Closes #12702
2014-03-01std: Switch stdout/stderr to buffered by defaultAlex Crichton-2/+2
Similarly to #12422 which made stdin buffered by default, this commit makes the output streams also buffered by default. Now that buffered writers will flush their contents when they are dropped, I don't believe that there's no reason why the output shouldn't be buffered by default, which is what you want in 90% of cases. As with stdin, there are new stdout_raw() and stderr_raw() functions to get unbuffered streams to stdout/stderr.
2014-02-27Fix typo in doc of Binary trait in std::fmtMickaël Delahaye-1/+1
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-0/+10
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-23auto merge of #12492 : huonw/rust/snapshots, r=alexcrichtonbors-5/+0
Replaces IterBytes with the new Hash, removing all trace of the old implementation.
2014-02-23Register snapshots.Huon Wilson-5/+0
2014-02-23rustdoc: Add syntax highlightingAlex Crichton-12/+12
This adds simple syntax highlighting based off libsyntax's lexer to be sure to stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc, but it definitely seems to get the job done! This currently doesn't highlight rustdoc-rendered function signatures and structs that are emitted to each page because the colors already signify what's clickable and I think we'd have to figure out a different scheme before colorizing them. This does, however, colorize all code examples and source code. Closes #11393
2014-02-22Decouple integer formatting from std::num::strconvBrendan Zabarauskas-121/+54
This works towards a complete rewrite and ultimate removal of the `std::num::strconv` module (see #6220), and the removal of the `ToStrRadix` trait in favour of using the `std::fmt` functionality directly. This should make for a cleaner API, encourage less allocation, and make the implementation far more comprehensible. The `Formatter::pad_integral` method has also been refactored make it easier to understand. The formatting tests for integers have been moved out of `run-pass/ifmt.rs` in order to provide more immediate feedback when building using `make check-stage2-std NO_REBUILD=1`. The benchmarks have been standardised between std::num::strconv and std::num::fmt to make it easier to compare the performance of the different implementations. Arbitrary radixes are now easier to use in format strings. For example: ~~~ assert_eq!(format!("{:04}", radix(3, 2)), ~"0011"); ~~~
2014-02-20Mass rename if_ok! to try!Alex Crichton-11/+11
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-16Minor documentation fixes in std::fmtSterling Greene-3/+3
* Change '...your own time' => '...your own type' * Fix typo in the Vector2D example
2014-02-15auto merge of #12298 : alexcrichton/rust/rustdoc-testing, r=sfacklerbors-6/+6
It's too easy to forget the `rust` tag to test something. Closes #11698
2014-02-15impl fmt::Pointer for &T and &mut TCorey Richardson-1/+11
2014-02-14Fix all code examplesAlex Crichton-6/+6
2014-02-11Move replace and swap to std::mem. Get rid of std::utilEdward Wang-5/+5
Also move Void to std::any, move drop to std::mem and reexport in prelude.
2014-02-08std::fmt: convert the formatting traits to a proper self.Huon Wilson-77/+77
Poly and String have polymorphic `impl`s and so require different method names.
2014-02-04Register new snapshotsAlex Crichton-5/+0
2014-02-03Fixing remaining warnings and errors throughoutAlex Crichton-18/+9
2014-02-03std: Fixing all documentationAlex Crichton-6/+16
* Stop referencing io_error * Start changing "Failure" sections to "Error" sections * Update all doc examples to work.
2014-02-03std: Remove io::io_errorAlex Crichton-86/+92
* All I/O now returns IoResult<T> = Result<T, IoError> * All formatting traits now return fmt::Result = IoResult<()> * The if_ok!() macro was added to libstd
2014-02-02Remove the SNAP line to work around #11985.Huon Wilson-2/+2
2014-02-02std::fmt: prepare to convert the formatting traits to methods, and workHuon Wilson-0/+35
around the lack of UFCS. The further work is pending a snapshot, to avoid putting #[cfg(stage0)] attributes on all the traits and duplicating them.
2014-02-02std: rename fmt::Default to `Show`.Huon Wilson-8/+27
This is a better name with which to have a #[deriving] mode. Decision in: https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-01-28
2014-02-02libextra: Remove `@str` from all the librariesPatrick Walton-1/+0
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-4/+4
2014-01-22Add LowerExp 'e' and UpperExp 'E' format traits/specifiersSiegeLord-0/+30
2014-01-21[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old ↵Simon Sapin-1/+1
from_utf8_owned() behavior
2014-01-21[std::str] Rename from_utf8_opt() to from_utf8(), drop the old from_utf8() ↵Simon Sapin-1/+1
behavior
2014-01-18Rename iterators for consistencyPalmer Cox-1/+1
Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over.
2014-01-17Tweak the interface of std::ioAlex Crichton-2/+2
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered private modules * Remove with_mem_writer * Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)
2014-01-08Remove the io::Decorator traitAlex Crichton-2/+1
This is just an unnecessary trait that no one's ever going to parameterize over and it's more useful to just define the methods directly on the types themselves. The implementors of this type almost always don't want inner_mut_ref() but they're forced to define it as well.
2014-01-03Remove std::eitherAlex Crichton-7/+7
2013-12-27std: uniform modules titles for docLuca Bruno-1/+1
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-23Fixing more doc testsAlex Crichton-1/+1
2013-12-23std: Fix all code examplesAlex Crichton-15/+26
2013-12-15std: fix spelling in docs.Huon Wilson-3/+3
2013-12-11Make 'self lifetime illegal.Erik Price-14/+14
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-12-04std::str: s/from_utf8_slice/from_utf8/, to make the basic case shorter.Huon Wilson-1/+1
2013-11-29Removed useless cmp::{min, max} reexports from the integer modulesMarvin Löbel-1/+1
2013-11-29Removed a few macro-expanding-to-module workaroundsMarvin Löbel-22/+17
Also documented a few issues
2013-11-28Register new snapshotsAlex Crichton-1/+1
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-14/+14
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-2/+4
2013-11-11Move std::rt::io to std::ioAlex Crichton-5/+5
2013-10-23Removed unnecessary comments and white spaces as suggestedreedlepee-4/+2
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-3/+0
2013-10-23Making fields in std and extra : private #4386reedlepee-2/+6
2013-10-21std: Move sys::log_str to repr::repr_to_str. Further work on #2240.Brian Anderson-7/+3
2013-10-19std::fmt: fix markdown peculiarity, unicodify some arrows, ` some trait names.Huon Wilson-14/+14
2013-10-18Document traits and Default about format! betterAlex Crichton-3/+48
Closes #9865 Closes #9808