Struct BufRefReader

Source
pub struct BufRefReader<R, B> { /* private fields */ }
Expand description

Buffering reader.

See module-level docs for examples.

Implementations§

Source§

impl<R: Read, B: Buffer> BufRefReader<R, B>
where Error: From<B::Error>,

Source

pub fn new(src: R) -> Result<BufRefReader<R, B>, B::Error>

Creates buffered reader with default options. Look for BufRefReaderBuilder for tweaks.

Source

pub fn read(&mut self, n: usize) -> Result<Option<&[u8]>, Error>

Returns requested amount of bytes, or less if EOF prevents reader from fulfilling the request.

Returns:

  • Ok(Some(data)) with, well, data,
  • Ok(None) if no more data is available,
  • Err(err): see std::io::Read::read()
Source

pub fn read_until(&mut self, delim: u8) -> Result<Option<&[u8]>, Error>

Returns bytes up until and including delim, or until EOF mark. If no content is available, returns None.

Returns:

  • Ok(Some(data)) with, well, data,
  • Ok(None) if no more data is available,
  • Err(err): see std::io::Read::read()

Auto Trait Implementations§

§

impl<R, B> Freeze for BufRefReader<R, B>
where R: Freeze, B: Freeze,

§

impl<R, B> RefUnwindSafe for BufRefReader<R, B>

§

impl<R, B> Send for BufRefReader<R, B>
where R: Send, B: Send,

§

impl<R, B> Sync for BufRefReader<R, B>
where R: Sync, B: Sync,

§

impl<R, B> Unpin for BufRefReader<R, B>
where R: Unpin, B: Unpin,

§

impl<R, B> UnwindSafe for BufRefReader<R, B>
where R: UnwindSafe, B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.