pub struct ZeroCopyProducer { /* private fields */ }Expand description
Zero-copy producer for high-throughput message production
Implementations§
Source§impl ZeroCopyProducer
impl ZeroCopyProducer
Sourcepub fn new(buffer_pool: Arc<ZeroCopyBufferPool>) -> Self
pub fn new(buffer_pool: Arc<ZeroCopyBufferPool>) -> Self
Create a new zero-copy producer
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a new zero-copy producer with default buffer pool
Sourcepub fn create_message(
&self,
topic: &str,
partition: u32,
key: Option<&[u8]>,
value: &[u8],
) -> ZeroCopyMessage
pub fn create_message( &self, topic: &str, partition: u32, key: Option<&[u8]>, value: &[u8], ) -> ZeroCopyMessage
Create a message with zero-copy value
Sourcepub fn create_message_from_bytes(
&self,
topic: &str,
partition: u32,
key: Option<Bytes>,
value: Bytes,
) -> ZeroCopyMessage
pub fn create_message_from_bytes( &self, topic: &str, partition: u32, key: Option<Bytes>, value: Bytes, ) -> ZeroCopyMessage
Create a message from existing Bytes (true zero-copy)
Sourcepub fn allocate(&self, size: usize) -> Option<(Arc<ZeroCopyBuffer>, usize)>
pub fn allocate(&self, size: usize) -> Option<(Arc<ZeroCopyBuffer>, usize)>
Allocate space in current buffer and return slice for direct writing
Sourcepub fn stats(&self) -> ProducerStatsSnapshot
pub fn stats(&self) -> ProducerStatsSnapshot
Get producer statistics
Auto Trait Implementations§
impl !Freeze for ZeroCopyProducer
impl !RefUnwindSafe for ZeroCopyProducer
impl Send for ZeroCopyProducer
impl Sync for ZeroCopyProducer
impl Unpin for ZeroCopyProducer
impl UnwindSafe for ZeroCopyProducer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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 more