Struct jsonrpc_tcp_server::tokio_core::io::EasyBuf
[−]
[src]
pub struct EasyBuf { /* fields omitted */ }: moved to the tokio-io crate
A reference counted buffer of bytes.
An EasyBuf is a representation of a byte buffer where sub-slices of it can
be handed out efficiently, each with a 'static lifetime which keeps the
data alive. The buffer also supports mutation but may require bytes to be
copied to complete the operation.
Methods
impl EasyBuf[src]
fn new() -> EasyBuf
: moved to the tokio-io crate
Creates a new EasyBuf with no data and the default capacity.
fn with_capacity(cap: usize) -> EasyBuf
: moved to the tokio-io crate
Creates a new EasyBuf with cap capacity.
fn len(&self) -> usize
: moved to the tokio-io crate
Returns the number of bytes contained in this EasyBuf.
fn as_slice(&self) -> &[u8]
: moved to the tokio-io crate
Returns the inner contents of this EasyBuf as a slice.
fn split_off(&mut self, at: usize) -> EasyBuf
: moved to the tokio-io crate
Splits the buffer into two at the given index.
Afterwards self contains elements [0, at), and the returned EasyBuf
contains elements [at, len).
This is an O(1) operation that just increases the reference count and sets a few indexes.
Panics
Panics if at > len
fn drain_to(&mut self, at: usize) -> EasyBuf
: moved to the tokio-io crate
Splits the buffer into two at the given index.
Afterwards self contains elements [at, len), and the returned EasyBuf
contains elements [0, at).
This is an O(1) operation that just increases the reference count and sets a few indexes.
Panics
Panics if at > len
fn get_mut(&mut self) -> EasyBufMut
: moved to the tokio-io crate
Returns a mutable reference to the underlying growable buffer of bytes.
If this EasyBuf is the only instance pointing at the underlying buffer
of bytes, a direct mutable reference will be returned. Otherwise the
contents of this EasyBuf will be reallocated in a fresh Vec<u8>
allocation with the same capacity as an EasyBuf created with EasyBuf::new(),
and that allocation will be returned.
This operation is not O(1) as it may clone the entire contents of this buffer.
The returned EasyBufMut type implement Deref and DerefMut to
Vec<u8> can the byte buffer can be manipulated using the standard
Vec<u8> methods.
Trait Implementations
impl Clone for EasyBuf[src]
impl<T> PartialOrd<T> for EasyBuf where
T: AsRef<[u8]>, [src]
T: AsRef<[u8]>,
fn partial_cmp(&self, other: &T) -> Option<Ordering>
: moved to the tokio-io crate
impl Into<Vec<u8>> for EasyBuf[src]
impl AsRef<[u8]> for EasyBuf[src]
impl Eq for EasyBuf[src]
impl From<Vec<u8>> for EasyBuf[src]
impl Ord for EasyBuf[src]
impl<T> PartialEq<T> for EasyBuf where
T: AsRef<[u8]>, [src]
T: AsRef<[u8]>,
impl Debug for EasyBuf[src]
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.