Trait reactive_mutiny::uni::GenericUni
source · pub trait GenericUni {
type ItemType: Send + Sync + Debug + 'static;
type DerivedItemType: Send + Sync + Debug + 'static;
type UniChannelType: FullDuplexUniChannel<'static, Self::ItemType, Self::DerivedItemType> + Send + Sync + 'static;
type MutinyStreamType;
const INSTRUMENTS: usize;
// Required method
fn new<IntoString: Into<String>>(uni_name: IntoString) -> Self;
}Expand description
This trait exists to allow simplifying generic declarations of concrete Unis types.
See also [GenericMulti].
Usage:
struct MyGenericStruct<T: GenericUni> { the_uni: T }
let the_uni = Uni<Lots,And,Lots<Of,Generic,Arguments>>::new();
let my_struct = MyGenericStruct { the_uni };
// see more at `tests/use_cases.rs`Required Associated Types§
sourcetype ItemType: Send + Sync + Debug + 'static
type ItemType: Send + Sync + Debug + 'static
The payload type this Uni’s producers will receive
sourcetype DerivedItemType: Send + Sync + Debug + 'static
type DerivedItemType: Send + Sync + Debug + 'static
The payload type this Uni’s Streams will yield
sourcetype UniChannelType: FullDuplexUniChannel<'static, Self::ItemType, Self::DerivedItemType> + Send + Sync + 'static
type UniChannelType: FullDuplexUniChannel<'static, Self::ItemType, Self::DerivedItemType> + Send + Sync + 'static
The channel through which payloads will travel from producers to consumers (see Uni for more info)
sourcetype MutinyStreamType
type MutinyStreamType
Defined as MutinyStream<'static, ItemType, UniChannelType, DerivedItemType>,
the concrete type for the Stream of DerivedItemTypes to be given to consumers
Required Associated Constants§
sourceconst INSTRUMENTS: usize
const INSTRUMENTS: usize
The instruments this Uni will collect/report
Required Methods§
sourcefn new<IntoString: Into<String>>(uni_name: IntoString) -> Self
fn new<IntoString: Into<String>>(uni_name: IntoString) -> Self
Creates a Uni, which implements the consumer pattern, capable of:
- creating
Streams; - applying a user-provided
processorto theStreams and executing them to depletion – the finalStreams may produce a combination of fallible/non-fallible & futures/non-futures events; - producing events that are sent to those
Streams.uni_nameis used for instrumentation purposes, depending on theINSTRUMENTgeneric argument passed to the Uni struct.