pub struct BufFactory;
Expand description
Handle to the crate’s static buffer pools.
Implementations§
Source§impl BufFactory
impl BufFactory
Sourcepub const MAX_BUF_SIZE: usize = 65_536usize
pub const MAX_BUF_SIZE: usize = 65_536usize
The maximum size of the buffers in the generic pool. Larger buffers will shrink to this size before returning to the pool.
Sourcepub const MAX_DGRAM_SIZE: usize = 1_500usize
pub const MAX_DGRAM_SIZE: usize = 1_500usize
The maximum size of the buffers in the datagram pool.
Sourcepub fn get_empty_buf() -> PooledBuf
pub fn get_empty_buf() -> PooledBuf
Creates an empty PooledBuf
which is not taken from the pool. When
dropped, it may be assigned to the generic pool if no longer empty.
Sourcepub fn get_empty_datagram() -> PooledDgram
pub fn get_empty_datagram() -> PooledDgram
Creates an empty PooledDgram
which is not taken from the pool. When
dropped, it may be assigned to the datagram pool if no longer empty.
Sourcepub fn get_max_buf() -> PooledBuf
pub fn get_max_buf() -> PooledBuf
Fetches a MAX_BUF_SIZE
sized PooledBuf
from the generic pool.
Sourcepub fn get_max_datagram() -> PooledDgram
pub fn get_max_datagram() -> PooledDgram
Fetches a MAX_DATAGRAM_SIZE
sized PooledDgram
from the datagram
pool.
Sourcepub fn dgram_from_vec(dgram: Vec<u8>) -> PooledDgram
pub fn dgram_from_vec(dgram: Vec<u8>) -> PooledDgram
Adds dgram
to the datagram pool without copying it.
Sourcepub fn buf_from_slice(slice: &[u8]) -> PooledBuf
pub fn buf_from_slice(slice: &[u8]) -> PooledBuf
Fetches a PooledBuf
from the generic pool and initializes it
with the contents of slice
.
Sourcepub fn dgram_from_slice(slice: &[u8]) -> PooledDgram
pub fn dgram_from_slice(slice: &[u8]) -> PooledDgram
Fetches a PooledDgram
from the datagram pool and initializes it
with the contents of slice
.
Trait Implementations§
Source§impl BufFactory for BufFactory
impl BufFactory for BufFactory
Source§impl Clone for BufFactory
impl Clone for BufFactory
Source§fn clone(&self) -> BufFactory
fn clone(&self) -> BufFactory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BufFactory
impl Debug for BufFactory
Source§impl Default for BufFactory
impl Default for BufFactory
Source§fn default() -> BufFactory
fn default() -> BufFactory
Auto Trait Implementations§
impl Freeze for BufFactory
impl RefUnwindSafe for BufFactory
impl Send for BufFactory
impl Sync for BufFactory
impl Unpin for BufFactory
impl UnwindSafe for BufFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more