pub struct FanoutProducer<const N: usize> { /* private fields */ }Expand description
SPSC producer handle for a fanout events region.
Publishes into the producer→router queue.
Semantics (v1):
- at-most-once enqueue into the producer queue
- bounded capacity;
Error::Fullwhen saturated
Implementations§
Source§impl<const N: usize> FanoutProducer<N>
impl<const N: usize> FanoutProducer<N>
Sourcepub fn publish(&self, data: &[u8]) -> Result<(), Error>
pub fn publish(&self, data: &[u8]) -> Result<(), Error>
Publish a byte payload into the producer→router queue.
Returns:
Ok(())if the message was committedErr(Error::TooLarge)ifdata.len() > INDEXBUS_SLOT_DATA_SIZEErr(Error::Full)if bounded capacity is exhausted
Sourcepub fn publish_with<F, E>(&self, f: F) -> Result<(), PublishWithError<E>>
pub fn publish_with<F, E>(&self, f: F) -> Result<(), PublishWithError<E>>
Publish by writing directly into the slot buffer.
The closure must return the number of bytes written. That length becomes the published message length.
§Errors
PublishWithError::Encode: the closure returned an error; no message is published.PublishWithError::Core: capacity/layout failures (e.g. full), orlen > INDEXBUS_SLOT_DATA_SIZE.
Trait Implementations§
impl<const N: usize> Send for FanoutProducer<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for FanoutProducer<N>
impl<const N: usize> !RefUnwindSafe for FanoutProducer<N>
impl<const N: usize> !Sync for FanoutProducer<N>
impl<const N: usize> Unpin for FanoutProducer<N>
impl<const N: usize> !UnwindSafe for FanoutProducer<N>
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