about summary refs log tree commit diff
path: root/src/libstd/io/buffered.rs
AgeCommit message (Collapse)AuthorLines
2015-12-29Fix warnings when compiling stdlib with --testFlorian Hahn-1/+1
2015-12-18Use memchr in libstd where possible, closes #30076Florian Hahn-1/+2
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+1
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-1/+1
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-148/+1
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-07-29Rollup merge of #27341 - steveklabnik:remove_warning, r=alexcrichtonSteve Klabnik-4/+0
This isn't a standard header, and the other docs don't use it, so let's remove it.
2015-07-27Remove warning header for consistencySteve Klabnik-4/+0
This isn't a standard header, and the other docs don't use it, so let's remove it.
2015-07-27std: Deprecate a number of unstable featuresAlex Crichton-1/+1
Many of these have long since reached their stage of being obsolete, so this commit starts the removal process for all of them. The unstable features that were deprecated are: * cmp_partial * fs_time * hash_default * int_slice * iter_min_max * iter_reset_fuse * iter_to_vec * map_in_place * move_from * owned_ascii_ext * page_size * read_and_zero * scan_state * slice_chars * slice_position_elem * subslice_offset
2015-07-22Rollup merge of #27170 - steveklabnik:doc_std_io_intoinnererror, r=alexcrichtonSteve Klabnik-1/+73
Mostly adding examples. r? @alexcrichton
2015-07-22Rollup merge of #27166 - steveklabnik:doc_std_io_linewriter, r=alexcrichtonSteve Klabnik-3/+120
Beef up the struct docs, add examples for the methods. r? @alexcrichton
2015-07-22Improve documentation for std::io::LineWriterSteve Klabnik-3/+120
Beef up the struct docs, add examples for the methods.
2015-07-22Improve documentation for std::io::BufWriterSteve Klabnik-5/+97
Mostly through adding examples.
2015-07-21Expand documentation for IntoInnerErrorSteve Klabnik-1/+73
Mostly adding examples.
2015-07-14Use Vec::drain in BufWriterUlrik Sverdrup-8/+1
I happened past a comment that asked for functionality that we now have.
2015-07-10More docs for std::io::BufReaderSteve Klabnik-4/+77
2015-07-08Auto merge of #26849 - bluss:read-to-end-memset, r=alexcrichtonbors-4/+1
Improve zerofill in Vec::resize and Read::read_to_end We needed a more efficient way to zerofill the vector in read_to_end. This to reduce the memory intialization overhead to a minimum. Use the implementation of `std::vec::from_elem` (used for the vec![] macro) for Vec::resize as well. For simple element types like u8, this compiles to memset, so it makes Vec::resize much more efficient.
2015-07-08io: Simplify BufReader::with_capacityUlrik Sverdrup-4/+1
Use the vec![] macro directly to create a sized, zeroed vector. This should result in a big speedup when creating BufReader, because vec![0; cap] compiles to a memset call, while the previous extend code currently did not.
2015-07-05std: small doc fixes for BufReader and BufWriterGeorg Brandl-8/+8
* fix probable copy-paste error in BufWriter.get_mut() * more consistent punctuation
2015-06-17More test fixes and fallout of stability changesAlex Crichton-0/+5
2015-06-17std: Deprecate the io::BufStream typeAlex Crichton-0/+4
Questions about the utility of this type has caused it to move to crates.io in the `bufstream` crate, so this type can be deprecated.
2015-05-19Add example code and cross-link to BufReader docsMatt Brubeck-0/+18
2015-05-05Auto merge of #25009 - alexcrichton:less-buffered-stream, r=aturonbors-10/+18
As pointed out in #17136 the semantics of a `BufStream` aren't always what one expects, and it looks like other [languages like C#][c-sharp] implement a buffered stream with only one underlying buffer. For now this commit destabilizes the primitive in the `std::io` module to give us some more time in figuring out what to do with it. [c-sharp]: https://msdn.microsoft.com/en-us/library/system.io.bufferedstream%28v=vs.110%29.aspx [breaking-change]
2015-05-01Auto merge of #25006 - alexcrichton:unstable-indexing, r=aturonbors-3/+3
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791 [breaking-change]
2015-05-01std: Remove index notation on slice iteratorsAlex Crichton-3/+3
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791
2015-04-30Add downcasting to std::error::ErrorAaron Turon-1/+2
This commit brings the `Error` trait in line with the [Error interoperation RFC](https://github.com/rust-lang/rfcs/pull/201) by adding downcasting, which has long been intended. This change means that for any `Error` trait objects that are `'static`, you can downcast to concrete error types. To make this work, it is necessary for `Error` to inherit from `Reflect` (which is currently used to mark concrete types as "permitted for reflection, aka downcasting"). This is a breaking change: it means that impls like ```rust impl<T> Error for MyErrorType<T> { ... } ``` must change to something like ```rust impl<T: Reflect> Error for MyErrorType<T> { ... } ``` except that `Reflect` is currently unstable (and should remain so for the time being). For now, code can instead bound by `Any`: ```rust impl<T: Any> Error for MyErrorType<T> { ... } ``` which *is* stable and has `Reflect` as a super trait. The downside is that this imposes a `'static` constraint, but that only constrains *when* `Error` is implemented -- it does not actually constrain the types that can implement `Error`. [breaking-change]
2015-04-30std: Destabilize io::BufStreamAlex Crichton-10/+18
As pointed out in #17136 the semantics of a `BufStream` aren't always what one expects, and it looks like other [languages like C#][c-sharp] implement a buffered stream with only one underlying buffer. For now this commit destabilizes the primitive in the `std::io` module to give us some more time in figuring out what to do with it. [c-sharp]: https://msdn.microsoft.com/en-us/library/system.io.bufferedstream%28v=vs.110%29.aspx [breaking-change]
2015-04-28Register new snapshotsTamir Duberstein-1/+0
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-2/+0
2015-04-08Implement io::Seek for io::BufWriter<W> where W: io::SeekKevin Ballard-0/+22
Seeking the `BufWriter` writes out its internal buffer before seeking.
2015-04-08Implement io::Seek for io::BufReader<R> where R: io::SeekKevin Ballard-2/+109
Seeking the `BufReader` discards the internal buffer (and adjusts the offset appropriately when seeking with `SeekFrom::Current(_)`).
2015-03-31Test fixes and rebase conflicts, round 3Alex Crichton-22/+22
2015-03-31rollup merge of #23919: alexcrichton/stabilize-io-errorAlex Crichton-1/+1
Conflicts: src/libstd/fs/tempdir.rs src/libstd/io/error.rs
2015-03-31std: Stabilize last bits of io::ErrorAlex Crichton-1/+1
This commit stabilizes a few remaining bits of the `io::Error` type: * The `Error::new` method is now stable. The last `detail` parameter was removed and the second `desc` parameter was generalized to `E: Into<Box<Error>>` to allow creating an I/O error from any form of error. Currently there is no form of downcasting, but this will be added in time. * An implementation of `From<&str> for Box<Error>` was added to liballoc to allow construction of errors from raw strings. * The `Error::raw_os_error` method was stabilized as-is. * Trait impls for `Clone`, `Eq`, and `PartialEq` were removed from `Error` as it is not possible to use them with trait objects. This is a breaking change due to the modification of the `new` method as well as the removal of the trait implementations for the `Error` type. [breaking-change]
2015-03-31rollup merge of #23879: seanmonstar/del-from-errorAlex Crichton-3/+3
Conflicts: src/libcore/error.rs
2015-03-30convert: remove FromError, use From<E> insteadSean McArthur-3/+3
This removes the FromError trait, since it can now be expressed using the new convert::Into trait. All implementations of FromError<E> where changed to From<E>, and `try!` was changed to use From::from instead. Because this removes FromError, it is a breaking change, but fixing it simply requires changing the words `FromError` to `From`, and `from_error` to `from`. [breaking-change]
2015-03-30std: Standardize (input, output) param orderingsAlex Crichton-2/+2
This functions swaps the order of arguments to a few functions that previously took (output, input) parameters, but now take (input, output) parameters (in that order). The affected functions are: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-28Fix massive performance issue in read_to_endSteven Fackler-28/+43
with_end_to_cap is enormously expensive now that it's initializing memory since it involves 64k allocation + memset on every call. This is most noticable when calling read_to_end on very small readers, where the new version if **4 orders of magnitude** faster. BufReader also depended on with_end_to_cap so I've rewritten it in its original form. As a bonus, converted the buffered IO struct Debug impls to use the debug builders. Fixes #23815
2015-03-27rollup merge of #23741: alexcrichton/remove-int-uintAlex Crichton-2/+2
Conflicts: src/librustc/middle/ty.rs src/librustc_trans/trans/adt.rs src/librustc_typeck/check/mod.rs src/libserialize/json.rs src/test/run-pass/spawn-fn.rs
2015-03-26syntax: Remove support for #[should_fail]Alex Crichton-1/+1
This attribute has been deprecated in favor of #[should_panic]. This also updates rustdoc to no longer accept the `should_fail` directive and instead renames it to `should_panic`.
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-2/+2
Now that support has been removed, all lingering use cases are renamed.
2015-03-24Added `Write` bounds to avoid a specialized Drop impl for `BufWriter`.Felix S. Klock II-9/+9
2015-03-23Stabilize the Error traitAaron Turon-1/+1
This small commit stabilizes the `Error` trait as-is, except that `Send` and `Debug` are added as constraints. The `Send` constraint is because most uses of `Error` will be for trait objects, and by default we would like these objects to be transferrable between threads. The `Debug` constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because types that implement `Display` should certainly implement `Debug` in any case. In the near future we expect to add `Any`-like downcasting features to `Error`, but this is waiting on some additional mechanisms (`Reflect`). It will be added before 1.0 via default methods. [breaking-change]
2015-03-18Fixed-size byte string literals (RFC 339)Vadim Petrochenkov-2/+2
2015-03-17std::io::buffered: Don't use 'flush' in documentation of into_innerMikhail Zabaluev-14/+15
The word 'flush' may be misinterpreted as if `flush` is called on the underlying writer, which is not the case.
2015-03-13Fallout of std::old_io deprecationAlex Crichton-0/+1
2015-03-12std: Stabilize the `io` moduleAlex Crichton-10/+57
The new `std::io` module has had some time to bake now, and this commit stabilizes its functionality. There are still portions of the module which remain unstable, and below contains a summart of the actions taken. This commit also deprecates the entire contents of the `old_io` module in a blanket fashion. All APIs should now have a reasonable replacement in the new I/O modules. Stable APIs: * `std::io` (the name) * `std::io::prelude` (the name) * `Read` * `Read::read` * `Read::{read_to_end, read_to_string}` after being modified to return a `usize` for the number of bytes read. * `Write` * `Write::write` * `Write::{write_all, write_fmt}` * `BufRead` * `BufRead::{fill_buf, consume}` * `BufRead::{read_line, read_until}` after being modified to return a `usize` for the number of bytes read. * `BufReader` * `BufReader::{new, with_capacity}` * `BufReader::{get_ref, get_mut, into_inner}` * `{Read,BufRead} for BufReader` * `BufWriter` * `BufWriter::{new, with_capacity}` * `BufWriter::{get_ref, get_mut, into_inner}` * `Write for BufWriter` * `IntoInnerError` * `IntoInnerError::{error, into_inner}` * `{Error,Display} for IntoInnerError` * `LineWriter` * `LineWriter::{new, with_capacity}` - `with_capacity` was added * `LineWriter::{get_ref, get_mut, into_inner}` - `get_mut` was added) * `Write for LineWriter` * `BufStream` * `BufStream::{new, with_capacities}` * `BufStream::{get_ref, get_mut, into_inner}` * `{BufRead,Read,Write} for BufStream` * `stdin` * `Stdin` * `Stdin::lock` * `Stdin::read_line` - added method * `StdinLock` * `Read for Stdin` * `{Read,BufRead} for StdinLock` * `stdout` * `Stdout` * `Stdout::lock` * `StdoutLock` * `Write for Stdout` * `Write for StdoutLock` * `stderr` * `Stderr` * `Stderr::lock` * `StderrLock` * `Write for Stderr` * `Write for StderrLock` * `io::Result` * `io::Error` * `io::Error::last_os_error` * `{Display, Error} for Error` Unstable APIs: (reasons can be found in the commit itself) * `Write::flush` * `Seek` * `ErrorKind` * `Error::new` * `Error::from_os_error` * `Error::kind` Deprecated APIs * `Error::description` - available via the `Error` trait * `Error::detail` - available via the `Display` implementation * `thread::Builder::{stdout, stderr}` Changes in functionality: * `old_io::stdio::set_stderr` is now a noop as the infrastructure for printing backtraces has migrated to `std::io`. * The `ReadExt`, `WriteExt`, and `BufReadExt` extension traits were all removed by folding functionality into the corresponding trait. [breaking-change]
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-2/+2
2015-02-25Rollup merge of #22729 - alexcrichton:ptr-stabilization, r=aturonManish Goregaokar-3/+3
Specifically, the following actions were takend: * The `copy_memory` and `copy_nonoverlapping_memory` functions to drop the `_memory` suffix (as it's implied by the functionality). Both functions are now marked as `#[stable]`. * The `set_memory` function was renamed to `write_bytes` and is now stable. * The `zero_memory` function is now deprecated in favor of `write_bytes` directly. * The `Unique` pointer type is now behind its own feature gate called `unique` to facilitate future stabilization. [breaking-change]
2015-02-24std: Stabilize some `ptr` functionsAlex Crichton-3/+3
Specifically, the following actions were taken: * The `copy_memory` and `copy_nonoverlapping_memory` functions to drop the `_memory` suffix (as it's implied by the functionality). Both functions are now marked as `#[stable]`. * The `set_memory` function was renamed to `write_bytes` and is now stable. * The `zero_memory` function is now deprecated in favor of `write_bytes` directly. * The `Unique` pointer type is now behind its own feature gate called `unique` to facilitate future stabilization. * All type parameters now are `T: ?Sized` wherever possible and new clauses were added to the `offset` functions to require that the type is sized. [breaking-change]
2015-02-24std::io::BufReader: remove leftover lifetime parameter on get_ref()Mikhail Zabaluev-1/+1