Struct read_collection::ReadBackChain
source · pub struct ReadBackChain<T, U> { /* private fields */ }Expand description
Adapter to chain together two ReadBacks.
This struct is generally created by calling read_back_chain on a reader.
Please see the documentation of read_back_chain for more details.
Implementations§
source§impl<T, U> ReadBackChain<T, U>
impl<T, U> ReadBackChain<T, U>
sourcepub fn into_inner(self) -> (T, U)
pub fn into_inner(self) -> (T, U)
Consumes the ReadBackChain, returning the wrapped readers.
§Examples
use std::io;
use read_collection::ReadBack;
fn main() -> io::Result<()> {
let mut data1: [u8; 3] = [1, 2, 3];
let mut data2: [u8; 3] = [4, 5, 6];
let read_back_chain = data1.as_slice().read_back_chain(data2.as_slice());
let (data1, data2) = read_back_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 ReadBackChain.
§Examples
use std::io;
use read_collection::ReadBack;
fn main() -> io::Result<()> {
let mut data1: [u8; 3] = [1, 2, 3];
let mut data2: [u8; 3] = [4, 5, 6];
let read_back_chain = data1.as_slice().read_back_chain(data2.as_slice());
let (data1, data2) = read_back_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 ReadBackChain.
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
ReadBackChain.
§Examples
use std::io;
use read_collection::ReadBack;
fn main() -> io::Result<()> {
let mut data1: [u8; 3] = [1, 2, 3];
let mut data2: [u8; 3] = [4, 5, 6];
let mut read_back_chain = data1.as_slice().read_back_chain(data2.as_slice());
let (data1, data2) = read_back_chain.get_mut();
Ok(())
}Trait Implementations§
source§impl<T: BufReadBack, U: BufReadBack> BufReadBack for ReadBackChain<T, U>
impl<T: BufReadBack, U: BufReadBack> BufReadBack for ReadBackChain<T, U>
source§fn read_back_fill_buf(&mut self) -> Result<&[u8]>
fn read_back_fill_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty. Read more
source§fn read_back_consume(&mut self, amt: usize)
fn read_back_consume(&mut self, amt: usize)
source§fn read_back_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
fn read_back_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes into
buf until the delimiter byte or the beginning of the reader is reached. Read moresource§fn read_back_has_data_left(&mut self) -> Result<bool>
fn read_back_has_data_left(&mut self) -> Result<bool>
source§fn read_back_skip_until(&mut self, delim: u8) -> Result<usize>
fn read_back_skip_until(&mut self, delim: u8) -> Result<usize>
Skip all bytes until the delimiter byte or the beginning is reached. Read more
source§fn read_back_line(&mut self, dest: &mut String) -> Result<usize>
fn read_back_line(&mut self, dest: &mut String) -> Result<usize>
Read all bytes until a newline (the
0xA byte) is reached, and prepend them to the provided String buffer. Read moresource§fn read_back_split(self, delim: u8) -> ReadBackSplit<Self> ⓘwhere
Self: Sized,
fn read_back_split(self, delim: u8) -> ReadBackSplit<Self> ⓘwhere
Self: Sized,
Returns an iterator over the contents of this reader split on the byte byte. Read more
source§fn read_back_lines(self) -> RevLines<Self>where
Self: Sized,
fn read_back_lines(self) -> RevLines<Self>where
Self: Sized,
Returns an iterator over the lines of this reader. Read more
source§impl<T: ReadBack, U: ReadBack> ReadBack for ReadBackChain<T, U>
impl<T: ReadBack, U: ReadBack> ReadBack for ReadBackChain<T, U>
source§fn read_back(&mut self, buf: &mut [u8]) -> Result<usize>
fn read_back(&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
source§fn read_back_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_back_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
source§fn read_back_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
fn read_back_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until the start of the source, placing them into
buf. Read moresource§fn read_back_to_string(&mut self, buf: &mut String) -> Result<usize>
fn read_back_to_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until the start of the source, prepending them to
buf (since we’re reading back). Read moresource§fn read_back_exact(&mut self, buf: &mut [u8]) -> Result<()>
fn read_back_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read back the exact number of bytes required to fill
buf. Read moresource§fn read_back_bytes(self) -> ReadBackBytes<Self> ⓘwhere
Self: Sized,
fn read_back_bytes(self) -> ReadBackBytes<Self> ⓘwhere
Self: Sized,
Transforms this
ReadBack instance to an Iterator over its bytes.
This can be also seen as “read the bytes of the instance in reverse”. Read moresource§fn read_back_chain<R: ReadBack>(self, next: R) -> ReadBackChain<Self, R>where
Self: Sized,
fn read_back_chain<R: ReadBack>(self, next: R) -> ReadBackChain<Self, R>where
Self: Sized,
Creates an adapter which will chain this stream with another. Read more
Auto Trait Implementations§
impl<T, U> Freeze for ReadBackChain<T, U>
impl<T, U> RefUnwindSafe for ReadBackChain<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for ReadBackChain<T, U>
impl<T, U> Sync for ReadBackChain<T, U>
impl<T, U> Unpin for ReadBackChain<T, U>
impl<T, U> UnwindSafe for ReadBackChain<T, U>where
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more