[][src]Struct vmap::io::BufReader

pub struct BufReader<R> { /* fields omitted */ }

The BufReader adds buffering to any reader using a specialized buffer.

This is very similar std::io::BufReader, but it uses a Ring for the internal buffer, and it provides a configurable low water mark.

Examples

use vmap::io::BufReader;

let sock = TcpStream::connect(srv.local_addr().unwrap())?;
let mut buf = BufReader::new(sock, 4000).expect("failed to create buffer");
let mut line = String::new();
let len = buf.read_line(&mut line)?;
assert_eq!(line, "hello\n");

Implementations

impl<R: Read> BufReader<R>[src]

pub fn new(inner: R, capacity: usize) -> Result<Self>[src]

Creates a new BufReader.

pub fn lowat(&self) -> usize[src]

Get the low-water level.

pub fn set_lowat(&mut self, val: usize)[src]

Set the low-water level.

When the internal buffer content length drops to this level, a subsequent read will request more from the inner reader.

pub fn get_ref(&self) -> &R[src]

Gets a reference to the underlying reader.

pub fn get_mut(&mut self) -> &mut R[src]

Gets a mutable reference to the underlying reader.

pub fn buffer(&self) -> &[u8][src]

Returns a reference to the internally buffered data.

pub fn into_inner(self) -> R[src]

Unwraps this BufReader, returning the underlying reader.

Trait Implementations

impl<R: Read> BufRead for BufReader<R>[src]

impl<R: Read> Read for BufReader<R>[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for BufReader<R> where
    R: RefUnwindSafe

impl<R> !Send for BufReader<R>

impl<R> !Sync for BufReader<R>

impl<R> Unpin for BufReader<R> where
    R: Unpin

impl<R> UnwindSafe for BufReader<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.