Trait ChannelMulti

Source
pub trait ChannelMulti<'a, ItemType: Debug + Send + Sync, DerivedItemType: Debug> {
    // Required methods
    fn create_stream_for_old_events(
        self: &Arc<Self>,
    ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
       where Self: ChannelConsumer<'a, DerivedItemType>;
    fn create_stream_for_new_events(
        self: &Arc<Self>,
    ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
       where Self: ChannelConsumer<'a, DerivedItemType>;
    fn create_streams_for_old_and_new_events(
        self: &Arc<Self>,
    ) -> ((MutinyStream<'a, ItemType, Self, DerivedItemType>, u32), (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32))
       where Self: ChannelConsumer<'a, DerivedItemType>;
    fn create_stream_for_old_and_new_events(
        self: &Arc<Self>,
    ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
       where Self: ChannelConsumer<'a, DerivedItemType>;
}
Expand description

Defines abstractions specific to [Uni] channels

Required Methods§

Source

fn create_stream_for_old_events( self: &Arc<Self>, ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
where Self: ChannelConsumer<'a, DerivedItemType>,

Implemented only for a few [Multi] channels, returns a Stream (and its stream_id) able to receive elements that were sent through this channel before the call to this method.
It is up to each implementor to define how back in the past those events may go, but it is known that mmap log based channels are able to see all past events.
If called more than once, every stream will see all the past events available.
Currently panics if called more times than allowed by [Multi]’s MAX_STREAMS

Source

fn create_stream_for_new_events( self: &Arc<Self>, ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
where Self: ChannelConsumer<'a, DerivedItemType>,

Returns a Stream (and its stream_id) able to receive elements sent through this channel after the call to this method.
If called more than once, each Stream will see all new elements – “listener pattern”.
Currently panics if called more times than allowed by [Multi]’s MAX_STREAMS

Source

fn create_streams_for_old_and_new_events( self: &Arc<Self>, ) -> ((MutinyStream<'a, ItemType, Self, DerivedItemType>, u32), (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32))
where Self: ChannelConsumer<'a, DerivedItemType>,

Implemented only for a few [Multi] channels, returns two Streams (and their stream_ids):

  • one for the past events (that, once exhausted, won’t see any of the forthcoming events)
  • another for the forthcoming events.

The split is guaranteed not to miss any events: no events will be lost between the last of the “past” and the first of the “forthcoming” events.
It is up to each implementor to define how back in the past those events may go, but it is known that mmap log based channels are able to see all past events.
If called more than once, every stream will see all the past events available, as well as all future events after this method call.
Currently panics if called more times than allowed by [Multi]’s MAX_STREAMS

Source

fn create_stream_for_old_and_new_events( self: &Arc<Self>, ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
where Self: ChannelConsumer<'a, DerivedItemType>,

Implemented only for a few [Multi] channels, returns a single Stream (and its stream_id) able to receive elements that were sent through this channel either before and after the call to this method.
It is up to each implementor to define how back in the past those events may go, but it is known that mmap log based channels are able to see all past events.
Notice that, with this method, there is no way of discriminating where the “old” events end and where the “new” events start.
If called more than once, every stream will see all the past events available, as well as all future events after this method call.
Currently panics if called more times than allowed by [Multi]’s MAX_STREAMS

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, ItemType: Send + Sync + Debug + 'a, OgreAllocatorType: BoundedOgreAllocator<ItemType> + 'a + Sync + Send, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for reactive_mutiny::multi::channels::ogre_arc::atomic::Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>

Source§

impl<'a, ItemType: Send + Sync + Debug + 'a, OgreAllocatorType: BoundedOgreAllocator<ItemType> + 'a + Sync + Send, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for reactive_mutiny::multi::channels::ogre_arc::full_sync::FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>

Source§

impl<'a, ItemType: Send + Sync + Debug + 'a, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, Arc<ItemType>> for Crossbeam<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>

Source§

impl<'a, ItemType: Send + Sync + Debug + 'a, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>

Source§

impl<'a, ItemType: Send + Sync + Debug + Default + 'a, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, Arc<ItemType>> for reactive_mutiny::multi::channels::arc::atomic::Atomic<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>

Source§

impl<'a, ItemType: Send + Sync + Debug + Default + 'a, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, Arc<ItemType>> for reactive_mutiny::multi::channels::arc::full_sync::FullSync<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>