pub struct TypedSpscSender<C> { /* private fields */ }Expand description
Typed SPSC sender that publishes v1-framed messages using codec C.
§Contract
- Publishes a v1 header prefix (
indexbus_msg) plus codec-defined payload bytes. - If encoding fails, no message is published.
Implementations§
Source§impl<C> TypedSpscSender<C>
impl<C> TypedSpscSender<C>
Source§impl<C> TypedSpscSender<C>
impl<C> TypedSpscSender<C>
Sourcepub fn publish<T>(&self, meta: MsgMeta, value: &T) -> Result<(), Error>where
C: CodecId + EncodeInto<T>,
pub fn publish<T>(&self, meta: MsgMeta, value: &T) -> Result<(), Error>where
C: CodecId + EncodeInto<T>,
Publish value with the provided message identity.
This encodes a v1 header into the slot prefix, encodes value into the payload region,
and publishes the resulting slot bytes.
§Errors
Error::TooLarge: the encoded payload does not fit in a single slot.Error::Codec/Error::Envelope: encoding failed.
Sourcepub fn publish_msg<T>(&self, value: &T) -> Result<(), Error>where
T: IndexbusMsgSpec,
C: CodecId + EncodeInto<T>,
pub fn publish_msg<T>(&self, value: &T) -> Result<(), Error>where
T: IndexbusMsgSpec,
C: CodecId + EncodeInto<T>,
Publish a typed message using compile-time identity (T::META).
This is sugar over Self::publish. Use publish(meta, value) if you need
dynamic identity or non-default flags.
Auto Trait Implementations§
impl<C> Freeze for TypedSpscSender<C>where
C: Freeze,
impl<C> !RefUnwindSafe for TypedSpscSender<C>
impl<C> Send for TypedSpscSender<C>where
C: Send,
impl<C> !Sync for TypedSpscSender<C>
impl<C> Unpin for TypedSpscSender<C>where
C: Unpin,
impl<C> !UnwindSafe for TypedSpscSender<C>
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