pub struct OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync + 'static, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync + 'static,
{ /* private fields */ }
Expand description

Wrapper type for data that requires a custom Drop to be called (through an OgreAllocator). Similar to C++’s unique_ptr

Implementations§

source§

impl<DataType, OgreAllocatorType> OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync + 'static, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

source

pub fn new<F>( setter: F, allocator: &OgreAllocatorType ) -> Option<OgreUnique<DataType, OgreAllocatorType>>

source

pub fn from_allocated_id( data_id: u32, allocator: &OgreAllocatorType ) -> OgreUnique<DataType, OgreAllocatorType>

source

pub fn from_allocated_ref( data_ref: &DataType, allocator: &OgreAllocatorType ) -> OgreUnique<DataType, OgreAllocatorType>

source

pub fn into_ogre_arc(self) -> OgreArc<DataType, OgreAllocatorType>

Trait Implementations§

source§

impl<DataType, OgreAllocatorType> AsRef<DataType> for OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

source§

fn as_ref(&self) -> &DataType

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<'a, ItemType, OgreUnique<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Send + Sync,

source§

fn new<IntoString>( name: IntoString ) -> Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
where IntoString: Into<String>,

Creates a new instance of this channel, to be referred to (in logs) as name
source§

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,

Waits until all pending items are taken from this channel, up until 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

Tells weather this channel is still enabled to process elements (true before calling the “end stream” / “cancel stream” functions)
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,

Flushes & signals that the given 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,

Flushes & signals that all streams should cease their activities when there are no more elements left to process, waiting for the operation to complete for up to 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)

Sends a signal to all streams, urging them to cease their operations.
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

Informs the caller how many active streams are currently managed by this channel IMPLEMENTORS: #[inline(always)]
source§

fn pending_items_count(&self) -> u32

Tells how many events are waiting to be taken out of this channel.
IMPLEMENTORS: #[inline(always)]
source§

fn buffer_size(&self) -> u32

Tells how many events may be produced ahead of the consumers.
IMPLEMENTORS: #[inline(always)]
source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<'a, ItemType, OgreUnique<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Send + Sync,

source§

fn new<IntoString>( streams_manager_name: IntoString ) -> Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>>
where IntoString: Into<String>,

Creates a new instance of this channel, to be referred to (in logs) as name
source§

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,

Waits until all pending items are taken from this channel, up until 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

Tells weather this channel is still enabled to process elements (true before calling the “end stream” / “cancel stream” functions)
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,

Flushes & signals that the given 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,

Flushes & signals that all streams should cease their activities when there are no more elements left to process, waiting for the operation to complete for up to 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)

Sends a signal to all streams, urging them to cease their operations.
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

Informs the caller how many active streams are currently managed by this channel IMPLEMENTORS: #[inline(always)]
source§

fn pending_items_count(&self) -> u32

Tells how many events are waiting to be taken out of this channel.
IMPLEMENTORS: #[inline(always)]
source§

fn buffer_size(&self) -> u32

Tells how many events may be produced ahead of the consumers.
IMPLEMENTORS: #[inline(always)]
source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelConsumer<'a, OgreUnique<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: 'static + Debug + Send + Sync, OgreAllocatorType: 'a + OgreAllocator<ItemType> + Send + Sync,

source§

fn consume( &self, _stream_id: u32 ) -> Option<OgreUnique<ItemType, OgreAllocatorType>>

Delivers the next event, whenever the Stream wants it.
IMPLEMENTORS: use #[inline(always)]
source§

fn keep_stream_running(&self, stream_id: u32) -> bool

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

Shares, to implementors concern, how stream_id may be awaken.
IMPLEMENTORS: use #[inline(always)]
source§

fn drop_resources(&self, stream_id: u32)

Reports no more elements will be required through [provide()].
IMPLEMENTORS: use #[inline(always)]
source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelConsumer<'a, OgreUnique<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: 'a + Debug + Send + Sync, OgreAllocatorType: 'a + OgreAllocator<ItemType> + Send + Sync,

source§

fn consume( &self, _stream_id: u32 ) -> Option<OgreUnique<ItemType, OgreAllocatorType>>

Delivers the next event, whenever the Stream wants it.
IMPLEMENTORS: use #[inline(always)]
source§

fn keep_stream_running(&self, stream_id: u32) -> bool

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

Shares, to implementors concern, how stream_id may be awaken.
IMPLEMENTORS: use #[inline(always)]
source§

fn drop_resources(&self, stream_id: u32)

Reports no more elements will be required through [provide()].
IMPLEMENTORS: use #[inline(always)]
source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelProducer<'a, ItemType, OgreUnique<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: 'a + Send + Sync + Debug, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Send + Sync,

source§

fn send(&self, item: ItemType) -> RetryResult<(), ItemType, (), ()>

Similar to Self::send_with(), but for sending the already-built item.
See there for how to deal with the returned type. IMPLEMENTORS: #[inline(always)]
source§

fn send_with<F>(&self, setter: F) -> RetryResult<(), F, (), ()>

Calls 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 more
source§

fn send_derived(&self, _derived_item: &DerivedItemType) -> bool

For channels that stores the 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, OgreUnique<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: 'a + Debug + Send + Sync, OgreAllocatorType: 'a + OgreAllocator<ItemType> + Send + Sync,

source§

fn send(&self, item: ItemType) -> RetryResult<(), ItemType, (), ()>

Similar to Self::send_with(), but for sending the already-built item.
See there for how to deal with the returned type. IMPLEMENTORS: #[inline(always)]
source§

fn send_with<F>(&self, setter: F) -> RetryResult<(), F, (), ()>

Calls 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 more
source§

fn send_derived(&self, _derived_item: &DerivedItemType) -> bool

For channels that stores the 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> ChannelUni<'a, ItemType, OgreUnique<ItemType, OgreAllocatorType>> for Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Send + Sync,

source§

fn create_stream( self: &Arc<Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> (MutinyStream<'a, ItemType, Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreUnique<ItemType, OgreAllocatorType>>, u32)
where Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: ChannelConsumer<'a, OgreUnique<ItemType, OgreAllocatorType>>,

Returns a Stream (and its stream_id) able to receive elements sent through this channel.
If called more than once, each Stream will receive a different element – “consumer pattern”.
Currently panics if called more times than allowed by [Uni]’s MAX_STREAMS
source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelUni<'a, ItemType, OgreUnique<ItemType, OgreAllocatorType>> for FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<ItemType> + 'a + Send + Sync,

source§

fn create_stream( self: &Arc<FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>> ) -> (MutinyStream<'a, ItemType, FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>, OgreUnique<ItemType, OgreAllocatorType>>, u32)
where FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>: ChannelConsumer<'a, OgreUnique<ItemType, OgreAllocatorType>>,

Returns a Stream (and its stream_id) able to receive elements sent through this channel.
If called more than once, each Stream will receive a different element – “consumer pattern”.
Currently panics if called more times than allowed by [Uni]’s MAX_STREAMS
source§

impl<DataType, OgreAllocatorType> Debug for OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<DataType, OgreAllocatorType> Deref for OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

§

type Target = DataType

The resulting type after dereferencing.
source§

fn deref(&self) -> &<OgreUnique<DataType, OgreAllocatorType> as Deref>::Target

Dereferences the value.
source§

impl<DataType, OgreAllocatorType> Display for OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync + Display, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<DataType, OgreAllocatorType> Drop for OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<DataType, OgreAllocatorType> From<OgreUnique<DataType, OgreAllocatorType>> for OgreArc<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

source§

fn from( ogre_unique: OgreUnique<DataType, OgreAllocatorType> ) -> OgreArc<DataType, OgreAllocatorType>

Converts to this type from the input type.
source§

impl<DataType, OgreAllocatorType> PartialEq<DataType> for OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync + PartialEq, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

source§

fn eq(&self, other: &DataType) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<DataType, OgreAllocatorType> Send for OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

source§

impl<DataType, OgreAllocatorType> Sync for OgreUnique<DataType, OgreAllocatorType>
where DataType: Debug + Send + Sync, OgreAllocatorType: OgreAllocator<DataType> + Send + Sync,

Auto Trait Implementations§

§

impl<DataType, OgreAllocatorType> RefUnwindSafe for OgreUnique<DataType, OgreAllocatorType>
where DataType: RefUnwindSafe, OgreAllocatorType: RefUnwindSafe,

§

impl<DataType, OgreAllocatorType> Unpin for OgreUnique<DataType, OgreAllocatorType>

§

impl<DataType, OgreAllocatorType> UnwindSafe for OgreUnique<DataType, OgreAllocatorType>
where DataType: RefUnwindSafe, OgreAllocatorType: RefUnwindSafe,

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V