Struct input_buffer::InputBuffer
[−]
[src]
pub struct InputBuffer(_);
A FIFO buffer for reading packets from network.
Methods
impl InputBuffer[src]
fn new() -> Self[src]
Create a new empty input buffer.
fn with_capacity(capacity: usize) -> Self[src]
Create a new empty input buffer.
fn from_partially_read(part: Vec<u8>) -> Self[src]
Create a input buffer filled with previously read data.
fn as_cursor(&self) -> &Cursor<Vec<u8>>[src]
Get the data as a cursor.
fn as_cursor_mut(&mut self) -> &mut Cursor<Vec<u8>>[src]
Get the data as a mutable cursor.
fn remove_garbage(&mut self)[src]
Remove the already consumed portion of the data.
fn into_vec(self) -> Vec<u8>[src]
Get the rest of the buffer and destroy the buffer.
fn read_from<S: Read>(&mut self, stream: &mut S) -> IoResult<usize>[src]
Read next portion of data from the given input stream.
fn prepare<'t>(&'t mut self) -> DoRead<'t>[src]
Prepare reading.
fn prepare_reserve<'t>(&'t mut self, reserve: usize) -> DoRead<'t>[src]
Prepare reading with the given reserve.
Trait Implementations
impl Buf for InputBuffer[src]
fn remaining(&self) -> usize[src]
Returns the number of bytes between the current position and the end of the buffer. Read more
fn bytes(&self) -> &[u8][src]
Returns a slice starting at the current position and of length between 0 and Buf::remaining(). Read more
fn advance(&mut self, size: usize)[src]
Advance the internal cursor of the Buf Read more
fn bytes_vec(&'a self, dst: &mut [&'a IoVec]) -> usize[src]
Fills dst with potentially multiple slices starting at self's current position. Read more
fn has_remaining(&self) -> bool[src]
Returns true if there are any more bytes to consume Read more
fn copy_to_slice(&mut self, dst: &mut [u8])[src]
Copies bytes from self into dst. Read more
fn get_u8(&mut self) -> u8[src]
Gets an unsigned 8 bit integer from self. Read more
fn get_i8(&mut self) -> i8[src]
Gets a signed 8 bit integer from self. Read more
fn get_u16<T>(&mut self) -> u16 where
T: ByteOrder, [src]
T: ByteOrder,
Gets an unsigned 16 bit integer from self in the specified byte order. Read more
fn get_i16<T>(&mut self) -> i16 where
T: ByteOrder, [src]
T: ByteOrder,
Gets a signed 16 bit integer from self in the specified byte order. Read more
fn get_u32<T>(&mut self) -> u32 where
T: ByteOrder, [src]
T: ByteOrder,
Gets an unsigned 32 bit integer from self in the specified byte order. Read more
fn get_i32<T>(&mut self) -> i32 where
T: ByteOrder, [src]
T: ByteOrder,
Gets a signed 32 bit integer from self in the specified byte order. Read more
fn get_u64<T>(&mut self) -> u64 where
T: ByteOrder, [src]
T: ByteOrder,
Gets an unsigned 64 bit integer from self in the specified byte order. Read more
fn get_i64<T>(&mut self) -> i64 where
T: ByteOrder, [src]
T: ByteOrder,
Gets a signed 64 bit integer from self in the specified byte order. Read more
fn get_uint<T>(&mut self, nbytes: usize) -> u64 where
T: ByteOrder, [src]
T: ByteOrder,
Gets an unsigned n-byte integer from self in the specified byte order. Read more
fn get_int<T>(&mut self, nbytes: usize) -> i64 where
T: ByteOrder, [src]
T: ByteOrder,
Gets a signed n-byte integer from self in the specified byte order. Read more
fn get_f32<T>(&mut self) -> f32 where
T: ByteOrder, [src]
T: ByteOrder,
Gets an IEEE754 single-precision (4 bytes) floating point number from self in the specified byte order. Read more
fn get_f64<T>(&mut self) -> f64 where
T: ByteOrder, [src]
T: ByteOrder,
Gets an IEEE754 double-precision (8 bytes) floating point number from self in the specified byte order. Read more
fn collect<B>(self) -> B where
B: FromBuf, [src]
B: FromBuf,
Transforms a Buf into a concrete buffer. Read more
fn take(self, limit: usize) -> Take<Self>[src]
Creates an adaptor which will read at most limit bytes from self. Read more
fn chain<U>(self, next: U) -> Chain<Self, <U as IntoBuf>::Buf> where
U: IntoBuf, [src]
U: IntoBuf,
Creates an adaptor which will chain this buffer with another. Read more
fn by_ref(&mut self) -> &mut Self[src]
Creates a "by reference" adaptor for this instance of Buf. Read more
fn reader(self) -> Reader<Self>[src]
Creates an adaptor which implements the Read trait for self. Read more
fn iter(self) -> Iter<Self>[src]
Returns an iterator over the bytes contained by the buffer. Read more