pub enum Buffer {
Heap(BufferData),
Shared(SharedBufferData),
HeapView {
data: BufferData,
start: usize,
},
Pooled(ArenaBuffer),
}Variants§
Heap(BufferData)
HeapView
A heap buffer with a logical start offset: only data[start..] is
exposed via Buffer::as_slice / Buffer::len. Used to skip a
pre-allocated prefix without shifting bytes in memory before I/O.
Pooled(ArenaBuffer)
Implementations§
Source§impl Buffer
impl Buffer
pub fn new(data: Vec<u8>) -> Self
Sourcepub fn new_with_start(data: Vec<u8>, start: usize) -> Self
pub fn new_with_start(data: Vec<u8>, start: usize) -> Self
Wraps data so that only bytes [start..] are visible via
Buffer::as_slice / Buffer::len. The skipped prefix lives in
memory but is never read by the I/O layer — useful when a caller
has pre-allocated optional framing room at the front of a buffer
and wants to elide it on a particular write without a memmove.
Sourcepub fn fixed_id(&self) -> Option<u32>
pub fn fixed_id(&self) -> Option<u32>
Returns the index of the underlying Arena if it was registered with
io_uring. Only for use with UringIO backend.
pub fn new_pooled(buf: ArenaBuffer) -> Self
pub fn new_temporary(size: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_mut_slice(&self) -> &mut [u8] ⓘ
pub fn as_ptr(&self) -> *const u8
pub fn as_mut_ptr(&self) -> *mut u8
pub fn is_pooled(&self) -> bool
pub fn is_heap(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnsafeUnpin for Buffer
impl UnwindSafe for Buffer
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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