std::io::Chain - Rust (original) (raw)
Struct std::io::Chain1.0.0 [−] [src]
pub struct Chain<T, U> { /* fields omitted */ }
Adaptor to chain together two readers.
This struct is generally created by calling chain on a reader. Please see the documentation of chain for more details.
impl<T, U> [Chain](../../std/io/struct.Chain.html "struct std::io::Chain")<T, U>
[src]
pub fn [into_inner](#method.into%5Finner)(self) -> [(](../primitive.tuple.html)T, U[)](../primitive.tuple.html)
1.20.0
Consumes the Chain
, returning the wrapped readers.
use std::io::prelude::*; use std::fs::File;
let mut foo_file = File::open("foo.txt")?; let mut bar_file = File::open("bar.txt")?;
let chain = foo_file.chain(bar_file); let (foo_file, bar_file) = chain.into_inner();Run
pub fn [get_ref](#method.get%5Fref)(&self) -> [(](../primitive.tuple.html)[&](../primitive.reference.html)T, [&](../primitive.reference.html)U[)](../primitive.tuple.html)
1.20.0
Gets references to the underlying readers in this Chain
.
use std::io::prelude::*; use std::fs::File;
let mut foo_file = File::open("foo.txt")?; let mut bar_file = File::open("bar.txt")?;
let chain = foo_file.chain(bar_file); let (foo_file, bar_file) = chain.get_ref();Run
pub fn [get_mut](#method.get%5Fmut)(&mut self) -> [(](../primitive.tuple.html)[&mut ](../primitive.reference.html)T, [&mut ](../primitive.reference.html)U[)](../primitive.tuple.html)
1.20.0
Gets mutable references to the underlying readers in this Chain
.
Care should be taken to avoid modifying the internal I/O state of the underlying readers as doing so may corrupt the internal state of thisChain
.
use std::io::prelude::*; use std::fs::File;
let mut foo_file = File::open("foo.txt")?; let mut bar_file = File::open("bar.txt")?;
let mut chain = foo_file.chain(bar_file); let (foo_file, bar_file) = chain.get_mut();Run
impl<T: [Debug](../../std/fmt/trait.Debug.html "trait std::fmt::Debug"), U: [Debug](../../std/fmt/trait.Debug.html "trait std::fmt::Debug")> [Debug](../../std/fmt/trait.Debug.html "trait std::fmt::Debug") for [Chain](../../std/io/struct.Chain.html "struct std::io::Chain")<T, U>
1.16.0
impl<T: [Read](../../std/io/trait.Read.html "trait std::io::Read"), U: [Read](../../std/io/trait.Read.html "trait std::io::Read")> [Read](../../std/io/trait.Read.html "trait std::io::Read") for [Chain](../../std/io/struct.Chain.html "struct std::io::Chain")<T, U>
[src]
fn [read](../../std/io/trait.Read.html#tymethod.read)(&mut self, buf: [&mut [](../primitive.slice.html)[u8](../primitive.u8.html)[]](../primitive.slice.html)) -> [Result](../../std/io/type.Result.html "type std::io::Result")<[usize](../primitive.usize.html)>
[src]
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
unsafe fn [initializer](../../std/io/trait.Read.html#method.initializer)(&self) -> [Initializer](../../std/io/struct.Initializer.html "struct std::io::Initializer")
[src]
🔬 This is a nightly-only experimental API. (read_initializer
#42788)
Determines if this Read
er can work with buffers of uninitialized memory. Read more
fn [read_to_end](../../std/io/trait.Read.html#method.read%5Fto%5Fend)(&mut self, buf: &mut [Vec](../../std/vec/struct.Vec.html "struct std::vec::Vec")<[u8](../primitive.u8.html)>) -> [Result](../../std/io/type.Result.html "type std::io::Result")<[usize](../primitive.usize.html)>
[src]
Read all bytes until EOF in this source, placing them into buf
. Read more
fn [read_to_string](../../std/io/trait.Read.html#method.read%5Fto%5Fstring)(&mut self, buf: &mut [String](../../std/string/struct.String.html "struct std:🧵:String")) -> [Result](../../std/io/type.Result.html "type std::io::Result")<[usize](../primitive.usize.html)>
[src]
Read all bytes until EOF in this source, appending them to buf
. Read more
fn [read_exact](../../std/io/trait.Read.html#method.read%5Fexact)(&mut self, buf: [&mut [](../primitive.slice.html)[u8](../primitive.u8.html)[]](../primitive.slice.html)) -> [Result](../../std/io/type.Result.html "type std::io::Result")<[()](../primitive.unit.html)>
1.6.0
Read the exact number of bytes required to fill buf
. Read more
`fn by_ref(&mut self) -> &mut Self where
Creates a "by reference" adaptor for this instance of Read
. Read more
ⓘImportant traits for Bytes
fn [bytes](../../std/io/trait.Read.html#method.bytes)(self) -> [Bytes](../../std/io/struct.Bytes.html "struct std::io::Bytes")<Self> where Self: [Sized](../../std/marker/trait.Sized.html "trait std:📑:Sized"),
[src]
Transforms this Read
instance to an [Iterator
] over its bytes. Read more
ⓘImportant traits for Chars
fn [chars](../../std/io/trait.Read.html#method.chars)(self) -> [Chars](../../std/io/struct.Chars.html "struct std::io::Chars")<Self> where Self: [Sized](../../std/marker/trait.Sized.html "trait std:📑:Sized"),
[src]
🔬 This is a nightly-only experimental API. (io
#27802)
the semantics of a partial read/write of where errors happen is currently unclear and may change
Transforms this Read
instance to an [Iterator
] over [char
]s. Read more
ⓘImportant traits for Chain<T, U>
fn [chain](../../std/io/trait.Read.html#method.chain)<R: [Read](../../std/io/trait.Read.html "trait std::io::Read")>(self, next: R) -> [Chain](../../std/io/struct.Chain.html "struct std::io::Chain")<Self, R> where Self: [Sized](../../std/marker/trait.Sized.html "trait std:📑:Sized"),
[src]
Creates an adaptor which will chain this stream with another. Read more
ⓘImportant traits for Take
fn [take](../../std/io/trait.Read.html#method.take)(self, limit: [u64](../primitive.u64.html)) -> [Take](../../std/io/struct.Take.html "struct std::io::Take")<Self> where Self: [Sized](../../std/marker/trait.Sized.html "trait std:📑:Sized"),
[src]
Creates an adaptor which will read at most limit
bytes from it. Read more
impl<T: [BufRead](../../std/io/trait.BufRead.html "trait std::io::BufRead"), U: [BufRead](../../std/io/trait.BufRead.html "trait std::io::BufRead")> [BufRead](../../std/io/trait.BufRead.html "trait std::io::BufRead") for [Chain](../../std/io/struct.Chain.html "struct std::io::Chain")<T, U>
1.9.0
fn [fill_buf](../../std/io/trait.BufRead.html#tymethod.fill%5Fbuf)(&mut self) -> [Result](../../std/io/type.Result.html "type std::io::Result")<[&[](../primitive.slice.html)[u8](../primitive.u8.html)[]](../primitive.slice.html)>
[src]
Fills the internal buffer of this object, returning the buffer contents. Read more
fn [consume](../../std/io/trait.BufRead.html#tymethod.consume)(&mut self, amt: [usize](../primitive.usize.html))
[src]
Tells this buffer that amt
bytes have been consumed from the buffer, so they should no longer be returned in calls to read
. Read more
fn [read_until](../../std/io/trait.BufRead.html#method.read%5Funtil)(&mut self, byte: [u8](../primitive.u8.html), buf: &mut [Vec](../../std/vec/struct.Vec.html "struct std::vec::Vec")<[u8](../primitive.u8.html)>) -> [Result](../../std/io/type.Result.html "type std::io::Result")<[usize](../primitive.usize.html)>
[src]
Read all bytes into buf
until the delimiter byte
or EOF is reached. Read more
fn [read_line](../../std/io/trait.BufRead.html#method.read%5Fline)(&mut self, buf: &mut [String](../../std/string/struct.String.html "struct std:🧵:String")) -> [Result](../../std/io/type.Result.html "type std::io::Result")<[usize](../primitive.usize.html)>
[src]
Read all bytes until a newline (the 0xA byte) is reached, and append them to the provided buffer. Read more
ⓘImportant traits for Split
fn [split](../../std/io/trait.BufRead.html#method.split)(self, byte: [u8](../primitive.u8.html)) -> [Split](../../std/io/struct.Split.html "struct std::io::Split")<Self> where Self: [Sized](../../std/marker/trait.Sized.html "trait std:📑:Sized"),
[src]
Returns an iterator over the contents of this reader split on the byte byte
. Read more
ⓘImportant traits for Lines
fn [lines](../../std/io/trait.BufRead.html#method.lines)(self) -> [Lines](../../std/io/struct.Lines.html "struct std::io::Lines")<Self> where Self: [Sized](../../std/marker/trait.Sized.html "trait std:📑:Sized"),
[src]
Returns an iterator over the lines of this reader. Read more