pub struct Chain<T, U> { /* private fields */ }
Expand description
Implementations
sourceimpl<T, U> Chain<T, U>
impl<T, U> Chain<T, U>
sourcepub fn into_inner(self) -> (T, U)
pub fn into_inner(self) -> (T, U)
Consumes the Chain
, returning the wrapped readers.
Examples
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
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();
Ok(())
}
sourcepub fn get_ref(&self) -> (&T, &U)
pub fn get_ref(&self) -> (&T, &U)
Gets references to the underlying readers in this Chain
.
Examples
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
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();
Ok(())
}
sourcepub fn get_mut(&mut self) -> (&mut T, &mut U)
pub fn get_mut(&mut self) -> (&mut T, &mut U)
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 this
Chain
.
Examples
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
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();
Ok(())
}
Trait Implementations
sourceimpl<T: BufRead, U: BufRead> BufRead for Chain<T, U>
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U>
sourceimpl<T: Read, U: Read> Read for Chain<T, U>
impl<T: Read, U: Read> Read for Chain<T, U>
sourcefn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
sourceunsafe fn initializer(&self) -> Initializer
unsafe fn initializer(&self) -> Initializer
Determines if this Read
er can work with buffers of uninitialized
memory. Read more
sourcefn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into buf
. Read more
sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill buf
. Read more
sourcefn by_ref(&mut self) -> &mut Self where
Self: Sized,
fn by_ref(&mut self) -> &mut Self where
Self: Sized,
Creates a “by reference” adaptor for this instance of Read
. Read more
sourcefn bytes(self) -> Bytes<Self>ⓘNotable traits for Bytes<R>impl<R: Read> Iterator for Bytes<R> type Item = Result<u8>;
where
Self: Sized,
fn bytes(self) -> Bytes<Self>ⓘNotable traits for Bytes<R>impl<R: Read> Iterator for Bytes<R> type Item = Result<u8>;
where
Self: Sized,
Auto Trait Implementations
impl<T, U> RefUnwindSafe for Chain<T, U> where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Chain<T, U> where
T: Send,
U: Send,
impl<T, U> Sync for Chain<T, U> where
T: Sync,
U: Sync,
impl<T, U> Unpin for Chain<T, U> where
T: Unpin,
U: Unpin,
impl<T, U> UnwindSafe for Chain<T, U> where
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more