pub struct BufferMut { /* private fields */ }Expand description
Mutable append-only builder used while bytes are still arriving.
When the ingest stream terminates, call BufferMut::freeze to
convert into an immutable ZeroCopyBuffer with a single Arc
construction (no copy).
Implementations§
Source§impl BufferMut
impl BufferMut
Sourcepub fn with_capacity(capacity: usize, kind: BufferKind) -> Self
pub fn with_capacity(capacity: usize, kind: BufferKind) -> Self
Build with initial reserved capacity.
pub fn with_tenant(self, tenant_id: impl Into<Arc<str>>) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
Sourcepub fn extend_from_slice(&mut self, bytes: &[u8])
pub fn extend_from_slice(&mut self, bytes: &[u8])
Append bytes. Grows the internal Vec using the standard
doubling policy.
Sourcepub fn freeze(self) -> ZeroCopyBuffer
pub fn freeze(self) -> ZeroCopyBuffer
Freeze into an immutable ZeroCopyBuffer. This is the moment
the storage transitions from Vec<u8> (unique mutable) to
Arc<[u8]> (shared immutable). The Vec -> Arc<[u8]>
conversion reuses the allocation when possible.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BufferMut
impl RefUnwindSafe for BufferMut
impl Send for BufferMut
impl Sync for BufferMut
impl Unpin for BufferMut
impl UnsafeUnpin for BufferMut
impl UnwindSafe for BufferMut
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
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 moreCreates a shared type from an unshared type.