Struct input_buffer::InputBuffer [−][src]
pub struct InputBuffer(_);
A FIFO buffer for reading packets from network.
Methods
impl InputBuffer
[src]
impl InputBuffer
pub fn new() -> Self
[src]
pub fn new() -> Self
Create a new empty input buffer.
pub fn with_capacity(capacity: usize) -> Self
[src]
pub fn with_capacity(capacity: usize) -> Self
Create a new empty input buffer.
pub fn from_partially_read(part: Vec<u8>) -> Self
[src]
pub fn from_partially_read(part: Vec<u8>) -> Self
Create a input buffer filled with previously read data.
pub fn as_cursor(&self) -> &Cursor<Vec<u8>>
[src]
pub fn as_cursor(&self) -> &Cursor<Vec<u8>>
Get the data as a cursor.
pub fn as_cursor_mut(&mut self) -> &mut Cursor<Vec<u8>>
[src]
pub fn as_cursor_mut(&mut self) -> &mut Cursor<Vec<u8>>
Get the data as a mutable cursor.
pub fn remove_garbage(&mut self)
[src]
pub fn remove_garbage(&mut self)
Remove the already consumed portion of the data.
pub fn into_vec(self) -> Vec<u8>
[src]
pub fn into_vec(self) -> Vec<u8>
Get the rest of the buffer and destroy the buffer.
pub fn read_from<S: Read>(&mut self, stream: &mut S) -> IoResult<usize>
[src]
pub fn read_from<S: Read>(&mut self, stream: &mut S) -> IoResult<usize>
Read next portion of data from the given input stream.
pub fn prepare<'t>(&'t mut self) -> DoRead<'t>
[src]
pub fn prepare<'t>(&'t mut self) -> DoRead<'t>
Prepare reading.
pub fn prepare_reserve<'t>(&'t mut self, reserve: usize) -> DoRead<'t>
[src]
pub fn prepare_reserve<'t>(&'t mut self, reserve: usize) -> DoRead<'t>
Prepare reading with the given reserve.
Trait Implementations
impl Debug for InputBuffer
[src]
impl Debug for InputBuffer
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Buf for InputBuffer
[src]
impl Buf for InputBuffer
fn remaining(&self) -> usize
[src]
fn remaining(&self) -> usize
Returns the number of bytes between the current position and the end of the buffer. Read more
fn bytes(&self) -> &[u8]
[src]
fn bytes(&self) -> &[u8]
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]
fn advance(&mut self, size: usize)
Advance the internal cursor of the Buf Read more
fn bytes_vec(&'a self, dst: &mut [&'a IoVec]) -> usize
[src]
fn bytes_vec(&'a self, dst: &mut [&'a IoVec]) -> usize
Fills dst
with potentially multiple slices starting at self
's current position. Read more
fn has_remaining(&self) -> bool
[src]
fn has_remaining(&self) -> bool
Returns true if there are any more bytes to consume Read more
fn copy_to_slice(&mut self, dst: &mut [u8])
[src]
fn copy_to_slice(&mut self, dst: &mut [u8])
Copies bytes from self
into dst
. Read more
fn get_u8(&mut self) -> u8
[src]
fn get_u8(&mut self) -> u8
Gets an unsigned 8 bit integer from self
. Read more
fn get_i8(&mut self) -> i8
[src]
fn get_i8(&mut self) -> i8
Gets a signed 8 bit integer from self
. Read more
fn get_u16_be(&mut self) -> u16
[src]
fn get_u16_be(&mut self) -> u16
Gets an unsigned 16 bit integer from self
in big-endian byte order. Read more
fn get_u16_le(&mut self) -> u16
[src]
fn get_u16_le(&mut self) -> u16
Gets an unsigned 16 bit integer from self
in little-endian byte order. Read more
fn get_i16_be(&mut self) -> i16
[src]
fn get_i16_be(&mut self) -> i16
Gets a signed 16 bit integer from self
in big-endian byte order. Read more
fn get_i16_le(&mut self) -> i16
[src]
fn get_i16_le(&mut self) -> i16
Gets a signed 16 bit integer from self
in little-endian byte order. Read more
fn get_u32_be(&mut self) -> u32
[src]
fn get_u32_be(&mut self) -> u32
Gets an unsigned 32 bit integer from self
in the big-endian byte order. Read more
fn get_u32_le(&mut self) -> u32
[src]
fn get_u32_le(&mut self) -> u32
Gets an unsigned 32 bit integer from self
in the little-endian byte order. Read more
fn get_i32_be(&mut self) -> i32
[src]
fn get_i32_be(&mut self) -> i32
Gets a signed 32 bit integer from self
in big-endian byte order. Read more
fn get_i32_le(&mut self) -> i32
[src]
fn get_i32_le(&mut self) -> i32
Gets a signed 32 bit integer from self
in little-endian byte order. Read more
fn get_u64_be(&mut self) -> u64
[src]
fn get_u64_be(&mut self) -> u64
Gets an unsigned 64 bit integer from self
in big-endian byte order. Read more
fn get_u64_le(&mut self) -> u64
[src]
fn get_u64_le(&mut self) -> u64
Gets an unsigned 64 bit integer from self
in little-endian byte order. Read more
fn get_i64_be(&mut self) -> i64
[src]
fn get_i64_be(&mut self) -> i64
Gets a signed 64 bit integer from self
in big-endian byte order. Read more
fn get_i64_le(&mut self) -> i64
[src]
fn get_i64_le(&mut self) -> i64
Gets a signed 64 bit integer from self
in little-endian byte order. Read more
fn get_uint_be(&mut self, nbytes: usize) -> u64
[src]
fn get_uint_be(&mut self, nbytes: usize) -> u64
Gets an unsigned n-byte integer from self
in big-endian byte order. Read more
fn get_uint_le(&mut self, nbytes: usize) -> u64
[src]
fn get_uint_le(&mut self, nbytes: usize) -> u64
Gets an unsigned n-byte integer from self
in little-endian byte order. Read more
fn get_int_be(&mut self, nbytes: usize) -> i64
[src]
fn get_int_be(&mut self, nbytes: usize) -> i64
Gets a signed n-byte integer from self
in big-endian byte order. Read more
fn get_int_le(&mut self, nbytes: usize) -> i64
[src]
fn get_int_le(&mut self, nbytes: usize) -> i64
Gets a signed n-byte integer from self
in little-endian byte order. Read more
fn get_f32_be(&mut self) -> f32
[src]
fn get_f32_be(&mut self) -> f32
Gets an IEEE754 single-precision (4 bytes) floating point number from self
in big-endian byte order. Read more
fn get_f32_le(&mut self) -> f32
[src]
fn get_f32_le(&mut self) -> f32
Gets an IEEE754 single-precision (4 bytes) floating point number from self
in little-endian byte order. Read more
fn get_f64_be(&mut self) -> f64
[src]
fn get_f64_be(&mut self) -> f64
Gets an IEEE754 double-precision (8 bytes) floating point number from self
in big-endian byte order. Read more
fn get_f64_le(&mut self) -> f64
[src]
fn get_f64_le(&mut self) -> f64
Gets an IEEE754 double-precision (8 bytes) floating point number from self
in little-endian byte order. Read more
fn collect<B>(self) -> B where
B: FromBuf,
[src]
fn collect<B>(self) -> B where
B: FromBuf,
Transforms a Buf
into a concrete buffer. Read more
fn take(self, limit: usize) -> Take<Self>
[src]
fn take(self, limit: usize) -> Take<Self>
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]
fn chain<U>(self, next: U) -> Chain<Self, <U as IntoBuf>::Buf> where
U: IntoBuf,
Creates an adaptor which will chain this buffer with another. Read more
fn by_ref(&mut self) -> &mut Self
[src]
fn by_ref(&mut self) -> &mut Self
Creates a "by reference" adaptor for this instance of Buf
. Read more
fn reader(self) -> Reader<Self>
[src]
fn reader(self) -> Reader<Self>
Creates an adaptor which implements the Read
trait for self
. Read more
fn iter(self) -> Iter<Self>
[src]
fn iter(self) -> Iter<Self>
Returns an iterator over the bytes contained by the buffer. Read more
Auto Trait Implementations
impl Send for InputBuffer
impl Send for InputBuffer
impl Sync for InputBuffer
impl Sync for InputBuffer