Struct Chain
struct Chain<T, U> { ... }
Adapter 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.
Implementations
impl<T, U> Chain<T, U>
fn into_inner(self: 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(()) }fn get_ref(self: &Self) -> (&T, &U)Gets 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 chain = foo_file.chain(bar_file); let (foo_file, bar_file) = chain.get_ref(); Ok(()) }fn get_mut(self: &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(()) }
impl<T> Any for Chain<T, U>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Chain<T, U>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Chain<T, U>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for Chain<T, U>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Freeze for Chain<T, U>
impl<T, U> Into for Chain<T, U>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> RefUnwindSafe for Chain<T, U>
impl<T, U> Send for Chain<T, U>
impl<T, U> Sync for Chain<T, U>
impl<T, U> TryFrom for Chain<T, U>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Chain<T, U>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T, U> Unpin for Chain<T, U>
impl<T, U> UnwindSafe for Chain<T, U>
impl<T: $crate::fmt::Debug, U: $crate::fmt::Debug> Debug for Chain<T, U>
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U>
fn fill_buf(self: &mut Self) -> Result<&[u8]>fn consume(self: &mut Self, amt: usize)fn read_until(self: &mut Self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
impl<T: Read, U: Read> Read for Chain<T, U>
fn read(self: &mut Self, buf: &mut [u8]) -> Result<usize>fn read_vectored(self: &mut Self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>fn is_read_vectored(self: &Self) -> boolfn read_to_end(self: &mut Self, buf: &mut Vec<u8>) -> Result<usize>fn read_buf(self: &mut Self, buf: BorrowedCursor<'_>) -> Result<()>