Struct reactive_messaging::prelude::OgreArc
source · pub struct OgreArc<DataType, OgreAllocatorType>where
DataType: Debug + Send + Sync,
OgreAllocatorType: OgreAllocator<DataType> + Send + Sync + 'static,{ /* private fields */ }Expand description
Wrapper type for data providing an atomic reference counter for dropping control, similar to Arc,
but allowing a custom allocator to be used – OgreAllocator.
providing reference counting similar to Arc
Implementations§
source§impl<DataType, OgreAllocatorType> OgreArc<DataType, OgreAllocatorType>where
DataType: Debug + Send + Sync,
OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,
impl<DataType, OgreAllocatorType> OgreArc<DataType, OgreAllocatorType>where DataType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,
sourcepub fn new(
allocator: &OgreAllocatorType
) -> Option<(OgreArc<DataType, OgreAllocatorType>, &mut DataType)>
pub fn new( allocator: &OgreAllocatorType ) -> Option<(OgreArc<DataType, OgreAllocatorType>, &mut DataType)>
Similar to Self::new_with().
Returns an uninitialized OgreAllocator with a reference to set its value;
None if the allocator is full
sourcepub fn new_with<F>(
setter: F,
allocator: &OgreAllocatorType
) -> Option<OgreArc<DataType, OgreAllocatorType>>where
F: FnOnce(&mut DataType),
pub fn new_with<F>( setter: F, allocator: &OgreAllocatorType ) -> Option<OgreArc<DataType, OgreAllocatorType>>where F: FnOnce(&mut DataType),
Zero-copy the data into one of the slots provided by allocator – which will be used to deallocate it when the time comes
– zero-copying will be enforced (if compiled in Release mode) due to this method being inlined in the caller.
None will be returned if there are, currently, no space available for the requested allocation.
A possible usage pattern for use cases that don’t care if we’re out of space is:
let allocator = <something from ogre_alloc::*>;
let data = <build your data here>;
let allocated_data = loop {
match OgreBox::new_with(|slot| *slot = data, allocator) {
Some(instance) => break instance,
None => <<out_of_elements_code>>, // sleep, warning, etc...
}
}sourcepub fn new_with_clones<const COUNT: usize, F>(
setter: F,
allocator: &OgreAllocatorType
) -> Option<[OgreArc<DataType, OgreAllocatorType>; COUNT]>where
F: FnOnce(&mut DataType),
pub fn new_with_clones<const COUNT: usize, F>( setter: F, allocator: &OgreAllocatorType ) -> Option<[OgreArc<DataType, OgreAllocatorType>; COUNT]>where F: FnOnce(&mut DataType),
Similar to [new()], but pre-loads the referenec_count to the specified COUNT value, returning all the clones.
This method is faster than calling [new()] & [clone()]
sourcepub fn from_allocated(
data_id: u32,
allocator: &OgreAllocatorType
) -> OgreArc<DataType, OgreAllocatorType>
pub fn from_allocated( data_id: u32, allocator: &OgreAllocatorType ) -> OgreArc<DataType, OgreAllocatorType>
Wraps data with our struct, so it will be properly deallocated when dropped
– data must have been previously allocated by the provided allocator
sourcepub fn from_allocated_with_clones<const COUNT: usize>(
data_id: u32,
allocator: &OgreAllocatorType
) -> [OgreArc<DataType, OgreAllocatorType>; COUNT]
pub fn from_allocated_with_clones<const COUNT: usize>( data_id: u32, allocator: &OgreAllocatorType ) -> [OgreArc<DataType, OgreAllocatorType>; COUNT]
Similar to [from_allocate()], but pre-loads the reference_count to the specified COUNT value, returning all the clones,
which is faster than repetitive calls to [clone()].
sourcepub unsafe fn increment_references(
&self,
count: u32
) -> &OgreArc<DataType, OgreAllocatorType>
pub unsafe fn increment_references( &self, count: u32 ) -> &OgreArc<DataType, OgreAllocatorType>
Safety
Increments the reference count of the passed [OgreUnique] by count.
To be used in conjunction with [raw_copy()] in order to produce several clones at once,
in the hope it will be faster than calling [clone()] several times
IMPORTANT: failure to call [raw_copy()] the same number of times as the parameter to [increment_references()] will crash the program
sourcepub unsafe fn raw_copy(&self) -> OgreArc<DataType, OgreAllocatorType>
pub unsafe fn raw_copy(&self) -> OgreArc<DataType, OgreAllocatorType>
Safety
Copies the [OgreUnique] (a simple 64-bit pointer) without increasing the reference count – but it will still be decreased when dropped.
To be used after a call to [increment_references()] in order to produce several clones at once,
in the hope it will be faster than calling [clone()] several times.
IMPORTANT: failure to call [raw_copy()] the same number of times as the parameter to [increment_references()] will crash the program
sourcepub fn references_count(&self) -> u32
pub fn references_count(&self) -> u32
Returns how many OgreBox<> copies references the same data as self does
Trait Implementations§
source§impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where
ItemType: Send + Sync + Debug + 'a,
OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where ItemType: Send + Sync + Debug + 'a, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
source§fn new<IntoString>(
name: IntoString
) -> Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>where
IntoString: Into<String>,
fn new<IntoString>( name: IntoString ) -> Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>where IntoString: Into<String>,
namesource§fn flush<'life0, 'async_trait>(
&'life0 self,
timeout: Duration
) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where
'life0: 'async_trait,
Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
fn flush<'life0, 'async_trait>( &'life0 self, timeout: Duration ) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where 'life0: 'async_trait, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
timeout elapses.Returns the number of still unconsumed items – which is 0 if it was not interrupted by the timeout
source§fn is_channel_open(&self) -> bool
fn is_channel_open(&self) -> bool
source§fn gracefully_end_stream<'life0, 'async_trait>(
&'life0 self,
stream_id: u32,
timeout: Duration
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
fn gracefully_end_stream<'life0, 'async_trait>( &'life0 self, stream_id: u32, timeout: Duration ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where 'life0: 'async_trait, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
stream_id should cease its activities when there are no more elements left
to process, waiting for the operation to complete for up to timeout.Returns
true if the stream ended within the given timeout or false if it is still processing elements.source§fn gracefully_end_all_streams<'life0, 'async_trait>(
&'life0 self,
timeout: Duration
) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where
'life0: 'async_trait,
Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
fn gracefully_end_all_streams<'life0, 'async_trait>( &'life0 self, timeout: Duration ) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where 'life0: 'async_trait, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
timeout.Returns the number of un-ended streams – which is 0 if it was not interrupted by the timeout
source§fn cancel_all_streams(&self)
fn cancel_all_streams(&self)
In opposition to [end_all_streams()], this method does not wait for any confirmation, nor cares if there are remaining elements to be processed.
source§fn running_streams_count(&self) -> u32
fn running_streams_count(&self) -> u32
source§fn pending_items_count(&self) -> u32
fn pending_items_count(&self) -> u32
IMPLEMENTORS: #[inline(always)]
source§fn buffer_size(&self) -> u32
fn buffer_size(&self) -> u32
IMPLEMENTORS: #[inline(always)]
source§impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where
ItemType: Send + Sync + Debug + 'a,
OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where ItemType: Send + Sync + Debug + 'a, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
source§fn new<IntoString>(
name: IntoString
) -> Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>where
IntoString: Into<String>,
fn new<IntoString>( name: IntoString ) -> Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>where IntoString: Into<String>,
namesource§fn flush<'life0, 'async_trait>(
&'life0 self,
timeout: Duration
) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where
'life0: 'async_trait,
FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
fn flush<'life0, 'async_trait>( &'life0 self, timeout: Duration ) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where 'life0: 'async_trait, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
timeout elapses.Returns the number of still unconsumed items – which is 0 if it was not interrupted by the timeout
source§fn is_channel_open(&self) -> bool
fn is_channel_open(&self) -> bool
source§fn gracefully_end_stream<'life0, 'async_trait>(
&'life0 self,
stream_id: u32,
timeout: Duration
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
fn gracefully_end_stream<'life0, 'async_trait>( &'life0 self, stream_id: u32, timeout: Duration ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where 'life0: 'async_trait, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
stream_id should cease its activities when there are no more elements left
to process, waiting for the operation to complete for up to timeout.Returns
true if the stream ended within the given timeout or false if it is still processing elements.source§fn gracefully_end_all_streams<'life0, 'async_trait>(
&'life0 self,
timeout: Duration
) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where
'life0: 'async_trait,
FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
fn gracefully_end_all_streams<'life0, 'async_trait>( &'life0 self, timeout: Duration ) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where 'life0: 'async_trait, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: 'async_trait,
timeout.Returns the number of un-ended streams – which is 0 if it was not interrupted by the timeout
source§fn cancel_all_streams(&self)
fn cancel_all_streams(&self)
In opposition to [end_all_streams()], this method does not wait for any confirmation, nor cares if there are remaining elements to be processed.
source§fn running_streams_count(&self) -> u32
fn running_streams_count(&self) -> u32
source§fn pending_items_count(&self) -> u32
fn pending_items_count(&self) -> u32
IMPLEMENTORS: #[inline(always)]
source§fn buffer_size(&self) -> u32
fn buffer_size(&self) -> u32
IMPLEMENTORS: #[inline(always)]
source§impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelConsumer<'a, OgreArc<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where
ItemType: 'a + Send + Sync + Debug,
OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelConsumer<'a, OgreArc<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where ItemType: 'a + Send + Sync + Debug, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
source§fn consume(
&self,
stream_id: u32
) -> Option<OgreArc<ItemType, OgreAllocatorType>>
fn consume( &self, stream_id: u32 ) -> Option<OgreArc<ItemType, OgreAllocatorType>>
IMPLEMENTORS: use #[inline(always)]
source§fn keep_stream_running(&self, stream_id: u32) -> bool
fn keep_stream_running(&self, stream_id: u32) -> bool
false if the Stream has been signaled to end its operations, causing it to report “out-of-elements” as soon as possible.IMPLEMENTORS: use #[inline(always)]
source§fn register_stream_waker(&self, stream_id: u32, waker: &Waker)
fn register_stream_waker(&self, stream_id: u32, waker: &Waker)
stream_id may be awaken.IMPLEMENTORS: use #[inline(always)]
source§fn drop_resources(&self, stream_id: u32)
fn drop_resources(&self, stream_id: u32)
IMPLEMENTORS: use #[inline(always)]
source§impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelConsumer<'a, OgreArc<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where
ItemType: 'a + Send + Sync + Debug,
OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelConsumer<'a, OgreArc<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where ItemType: 'a + Send + Sync + Debug, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
source§fn consume(
&self,
stream_id: u32
) -> Option<OgreArc<ItemType, OgreAllocatorType>>
fn consume( &self, stream_id: u32 ) -> Option<OgreArc<ItemType, OgreAllocatorType>>
IMPLEMENTORS: use #[inline(always)]
source§fn keep_stream_running(&self, stream_id: u32) -> bool
fn keep_stream_running(&self, stream_id: u32) -> bool
false if the Stream has been signaled to end its operations, causing it to report “out-of-elements” as soon as possible.IMPLEMENTORS: use #[inline(always)]
source§fn register_stream_waker(&self, stream_id: u32, waker: &Waker)
fn register_stream_waker(&self, stream_id: u32, waker: &Waker)
stream_id may be awaken.IMPLEMENTORS: use #[inline(always)]
source§fn drop_resources(&self, stream_id: u32)
fn drop_resources(&self, stream_id: u32)
IMPLEMENTORS: use #[inline(always)]
source§impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where
ItemType: Send + Sync + Debug + 'a,
OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where ItemType: Send + Sync + Debug + 'a, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
source§fn create_stream_for_old_events(
self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
) -> (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
fn create_stream_for_old_events( self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
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_STREAMSsource§fn create_stream_for_new_events(
self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
) -> (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
fn create_stream_for_new_events( self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
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_STREAMSsource§fn create_streams_for_old_and_new_events(
self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
) -> ((MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32), (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32))
fn create_streams_for_old_and_new_events( self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> ((MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32), (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32))
source§fn create_stream_for_old_and_new_events(
self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
) -> (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
fn create_stream_for_old_and_new_events( self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
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_STREAMSsource§impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where
ItemType: Send + Sync + Debug + 'a,
OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where ItemType: Send + Sync + Debug + 'a, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
source§fn create_stream_for_old_events(
self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
) -> (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
fn create_stream_for_old_events( self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
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_STREAMSsource§fn create_stream_for_new_events(
self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
) -> (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
fn create_stream_for_new_events( self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
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_STREAMSsource§fn create_streams_for_old_and_new_events(
self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
) -> ((MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32), (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32))
fn create_streams_for_old_and_new_events( self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> ((MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32), (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32))
source§fn create_stream_for_old_and_new_events(
self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
) -> (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
fn create_stream_for_old_and_new_events( self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreArc<ItemType, OgreAllocatorType>>, u32)
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_STREAMSsource§impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelProducer<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where
ItemType: 'a + Send + Sync + Debug,
OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelProducer<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where ItemType: 'a + Send + Sync + Debug, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
source§fn send(&self, item: ItemType) -> RetryResult<(), ItemType, (), ()>
fn send(&self, item: ItemType) -> RetryResult<(), ItemType, (), ()>
item.See there for how to deal with the returned type. IMPLEMENTORS: #[inline(always)]
source§fn send_with<F>(&self, setter: F) -> RetryResult<(), F, (), ()>where
F: FnOnce(&mut ItemType),
fn send_with<F>(&self, setter: F) -> RetryResult<(), F, (), ()>where F: FnOnce(&mut ItemType),
setter, passing a slot so the payload may be filled there, then sends the event through this channel asynchronously.The returned type is conversible to
Result<(), F> by calling .into() on it, returning Err<setter> when the buffer is full,
to allow the caller to try again; otherwise you may add any retrying logic using the keen-retry crate’s API like in: Read moresource§fn send_derived(
&self,
ogre_arc_item: &OgreArc<ItemType, OgreAllocatorType>
) -> bool
fn send_derived( &self, ogre_arc_item: &OgreArc<ItemType, OgreAllocatorType> ) -> bool
DerivedItemType instead of the ItemType, this method may be useful
– for instance: if the Stream consumes Arc<String> (the derived item type) and the channel is for Strings, With this method one may send an Arc directly.The default implementation, though, is made for types that don’t have a derived item type.
IMPLEMENTORS: #[inline(always)]
source§impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelProducer<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where
ItemType: 'a + Send + Sync + Debug,
OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelProducer<'a, ItemType, OgreArc<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>where ItemType: 'a + Send + Sync + Debug, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Sync + Send,
source§fn send(&self, item: ItemType) -> RetryResult<(), ItemType, (), ()>
fn send(&self, item: ItemType) -> RetryResult<(), ItemType, (), ()>
item.See there for how to deal with the returned type. IMPLEMENTORS: #[inline(always)]
source§fn send_with<F>(&self, setter: F) -> RetryResult<(), F, (), ()>where
F: FnOnce(&mut ItemType),
fn send_with<F>(&self, setter: F) -> RetryResult<(), F, (), ()>where F: FnOnce(&mut ItemType),
setter, passing a slot so the payload may be filled there, then sends the event through this channel asynchronously.The returned type is conversible to
Result<(), F> by calling .into() on it, returning Err<setter> when the buffer is full,
to allow the caller to try again; otherwise you may add any retrying logic using the keen-retry crate’s API like in: Read moresource§fn send_derived(
&self,
ogre_arc_item: &OgreArc<ItemType, OgreAllocatorType>
) -> bool
fn send_derived( &self, ogre_arc_item: &OgreArc<ItemType, OgreAllocatorType> ) -> bool
DerivedItemType instead of the ItemType, this method may be useful
– for instance: if the Stream consumes Arc<String> (the derived item type) and the channel is for Strings, With this method one may send an Arc directly.The default implementation, though, is made for types that don’t have a derived item type.
IMPLEMENTORS: #[inline(always)]