TypedFanoutConsumer

Struct TypedFanoutConsumer 

Source
pub struct TypedFanoutConsumer<const N: usize, C> { /* private fields */ }
Expand description

Typed fanout consumer that decodes v1-framed messages using codec C.

See TypedSpscReceiver for receive-side partial-effect semantics.

Implementations§

Source§

impl<const N: usize, C> TypedFanoutConsumer<N, C>

Source

pub fn new(inner: FanoutConsumer<N>, codec: C) -> Self

Wrap an indexbus-core fanout consumer with a codec.

Source§

impl<const N: usize, C> TypedFanoutConsumer<N, C>

Source

pub fn try_recv_borrowed_with<T, F, R>( &self, meta: MsgMeta, f: F, ) -> Result<Option<R>, Error>
where C: CodecId + DecodeBorrowed<T>, F: for<'a> FnMut(Header, <C as DecodeBorrowed<T>>::View<'a>) -> Result<R, Error>,

Receive a typed borrowed view and process it within f.

See TypedSpscReceiver::try_recv_borrowed_with for partial-effect semantics.

Source

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<const N: usize, C> TypedFanoutConsumer<N, C>

Source

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 empty (or when the consumer index is out of range).

See TypedSpscReceiver::try_recv_owned for partial-effect semantics.

Source

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).

Auto Trait Implementations§

§

impl<const N: usize, C> Freeze for TypedFanoutConsumer<N, C>
where C: Freeze,

§

impl<const N: usize, C> !RefUnwindSafe for TypedFanoutConsumer<N, C>

§

impl<const N: usize, C> Send for TypedFanoutConsumer<N, C>
where C: Send,

§

impl<const N: usize, C> !Sync for TypedFanoutConsumer<N, C>

§

impl<const N: usize, C> Unpin for TypedFanoutConsumer<N, C>
where C: Unpin,

§

impl<const N: usize, C> !UnwindSafe for TypedFanoutConsumer<N, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.