about summary refs log tree commit diff
path: root/src/libstd/io/extensions.rs
AgeCommit message (Collapse)AuthorLines
2014-02-03std: Fix tests with io_error usageAlex Crichton-84/+48
2014-02-03std: Remove io::io_errorAlex Crichton-1/+1
* 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-01Optimize u64_to_{le,be}_bytesBjörn Steinbrink-28/+14
LLVM fails to properly optimize the shifts used to convert the source value to the right endianess. The resulting assembly copies the value to the stack one byte at a time even when there's no conversion required (e.g. u64_to_le_bytes on a little endian machine). Instead of doing the conversion ourselves using shifts, we can use the existing intrinsics to perform the endianess conversion and then transmute the value to get a fixed vector of its bytes. Before: test be_i8 ... bench: 21442 ns/iter (+/- 70) test be_i16 ... bench: 21447 ns/iter (+/- 45) test be_i32 ... bench: 23832 ns/iter (+/- 63) test be_i64 ... bench: 26887 ns/iter (+/- 267) test le_i8 ... bench: 21442 ns/iter (+/- 56) test le_i16 ... bench: 21448 ns/iter (+/- 36) test le_i32 ... bench: 23825 ns/iter (+/- 153) test le_i64 ... bench: 26271 ns/iter (+/- 138) After: test be_i8 ... bench: 21438 ns/iter (+/- 10) test be_i16 ... bench: 21441 ns/iter (+/- 15) test be_i32 ... bench: 19057 ns/iter (+/- 6) test be_i64 ... bench: 21439 ns/iter (+/- 34) test le_i8 ... bench: 21438 ns/iter (+/- 19) test le_i16 ... bench: 21439 ns/iter (+/- 8) test le_i32 ... bench: 21439 ns/iter (+/- 19) test le_i64 ... bench: 21438 ns/iter (+/- 22)
2014-01-30Prefix _ to unused variables.OGINO Masanori-1/+1
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-2/+2
2014-01-25Uppercase numeric constantsChris Wong-4/+4
The following are renamed: * `min_value` => `MIN` * `max_value` => `MAX` * `bits` => `BITS` * `bytes` => `BYTES` Fixes #10010.
2014-01-21Remove unnecessary parentheses.Huon Wilson-1/+1
2014-01-18Rename iterators for consistencyPalmer Cox-6/+6
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-17auto merge of #11598 : alexcrichton/rust/io-export, r=brsonbors-1/+1
* 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) cc #11119
2014-01-17Tweak the interface of std::ioAlex Crichton-1/+1
* 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-12Removed remnants of `@mut` and `~mut` from comments and the type system.Eduard Burtescu-3/+3
2014-01-10std::io: Optimize u64_from_be_bytes()Carl-Anton Ingmarsson-11/+19
Instead of reading a byte at a time in a loop we copy the relevant bytes into a temporary vector of size eight. We can then read the value from the temporary vector using a single u64 read. LLVM seems to be able to optimize this almost scarily good.
2014-01-10std::io: Add tests and benchmarks for u64_from_be_bytes()Carl-Anton Ingmarsson-0/+82
2014-01-09Remove eof() from io::ReaderAlex Crichton-18/+0
2014-01-08Remove the io::Decorator traitAlex Crichton-6/+5
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-07stdtest: Fix all leaked trait importsAlex Crichton-4/+5
2014-01-07std: Fill in all missing importsAlex Crichton-0/+1
Fallout from the previous commits
2014-01-03libsyntax: Fix tests.Patrick Walton-0/+1
2014-01-03libstd: Remove a spurious `@mut` from a disabled testPatrick Walton-2/+3
2013-12-11std::io: Add Buffer.lines(), change .bytes() apiklutzy-15/+9
- `Buffer.lines()` returns `LineIterator` which yields line using `.read_line()`. - `Reader.bytes()` now takes `&mut self` instead of `self`. - `Reader.read_until()` swallows `EndOfFile`. This also affects `.read_line()`.
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-16/+16
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-4/+2
2013-11-11Move std::rt::io to std::ioAlex Crichton-0/+491