pub struct MpscProducer { /* private fields */ }Expand description
MPSC producer handle for a SharedLayout events region.
Semantics (v1):
- at-most-once delivery
- per-producer ordering preserved; cross-producer ordering not guaranteed
- bounded capacity;
publish*returnsError::Fullwhen saturated
Implementations§
Source§impl MpscProducer
impl MpscProducer
Sourcepub fn publish(&self, data: &[u8]) -> Result<(), Error>
pub fn publish(&self, data: &[u8]) -> Result<(), Error>
Publish a byte payload.
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.
Sourcepub fn try_publish_slot(&self, slot: EventsSlot) -> Result<(), PublishSlotError>
pub fn try_publish_slot(&self, slot: EventsSlot) -> Result<(), PublishSlotError>
Publish a previously-received slot by forwarding its slot index into this producer’s queue.
On failure, returns the original slot back to the caller.
Sourcepub fn publish_slot(&self, slot: EventsSlot) -> Result<(), Error>
pub fn publish_slot(&self, slot: EventsSlot) -> Result<(), Error>
Publish a previously-received slot, discarding it on failure.
Trait Implementations§
impl Send for MpscProducer
impl Sync for MpscProducer
Auto Trait Implementations§
impl Freeze for MpscProducer
impl !RefUnwindSafe for MpscProducer
impl Unpin for MpscProducer
impl !UnwindSafe for MpscProducer
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