pub struct TypedSpscReceiver<C> { /* private fields */ }Expand description
Typed SPSC receiver that decodes v1-framed messages using codec C.
§Partial effects
Receive helpers follow indexbus-core semantics: if a message is dequeued and validation or
decoding fails, the message is still considered consumed.
Implementations§
Source§impl<C> TypedSpscReceiver<C>
impl<C> TypedSpscReceiver<C>
Source§impl<C> TypedSpscReceiver<C>
impl<C> TypedSpscReceiver<C>
Sourcepub fn try_recv_borrowed_with<T, F, R>(
&self,
meta: MsgMeta,
f: F,
) -> Result<Option<R>, Error>
pub fn try_recv_borrowed_with<T, F, R>( &self, meta: MsgMeta, f: F, ) -> Result<Option<R>, Error>
Receive a typed borrowed view and process it within f.
The borrowed view is only valid for the duration of the call.
§Partial effects
If a message is dequeued, any error returned by f (or by envelope/meta/codec validation)
still consumes that message.
Sourcepub fn try_recv_borrowed_msg_with<T, F, R>(
&self,
f: F,
) -> Result<Option<R>, Error>where
T: IndexbusMsgSpec,
C: CodecId + DecodeBorrowed<T>,
F: for<'a> FnMut(Header, <C as DecodeBorrowed<T>>::View<'a>) -> Result<R, Error>,
pub fn try_recv_borrowed_msg_with<T, F, R>(
&self,
f: F,
) -> Result<Option<R>, Error>where
T: IndexbusMsgSpec,
C: CodecId + DecodeBorrowed<T>,
F: for<'a> FnMut(Header, <C as DecodeBorrowed<T>>::View<'a>) -> Result<R, Error>,
Receive a typed borrowed view using compile-time identity (T::META).
Source§impl<C> TypedSpscReceiver<C>
impl<C> TypedSpscReceiver<C>
Sourcepub fn try_recv_owned<T>(
&self,
meta: MsgMeta,
) -> Result<Option<(Header, T)>, Error>where
C: CodecId + DecodeFrom<T>,
pub fn try_recv_owned<T>(
&self,
meta: MsgMeta,
) -> Result<Option<(Header, T)>, Error>where
C: CodecId + DecodeFrom<T>,
Receive and decode a typed owned value.
Returns Ok(None) when the queue is empty. On success returns the decoded v1 header and
decoded value.
§Partial effects
If a message is dequeued, any error (envelope/meta/codec) still consumes that message.
Sourcepub fn try_recv_owned_msg<T>(&self) -> Result<Option<(Header, T)>, Error>where
T: IndexbusMsgSpec,
C: CodecId + DecodeFrom<T>,
pub fn try_recv_owned_msg<T>(&self) -> Result<Option<(Header, T)>, Error>where
T: IndexbusMsgSpec,
C: CodecId + DecodeFrom<T>,
Receive a typed owned value using compile-time identity (T::META).