pub struct Subscribers<StateT: AgentState = Value, FwdPropsT: FwdProps = Value> { /* private fields */ }Expand description
Wrapper for subscriber implementations.
Facilitates easy casting to and from types that implement AgentSubscriber.
§Examples
// Create from a single subscriber
let subscriber = MySubscriber;
let subscribers = Subscribers::from_subscriber(subscriber);
// Create from multiple subscribers
let subscriber_vec = vec![MySubscriber, MySubscriber];
let subscribers = Subscribers::from_iter(subscriber_vec);
// Create from pre-wrapped Arc subscribers
let arc_subscribers: Vec<Arc<dyn AgentSubscriber>> = vec![
Arc::new(MySubscriber)
];
let subscribers = Subscribers::new(arc_subscribers);Implementations§
Source§impl<StateT: AgentState, FwdPropsT: FwdProps> Subscribers<StateT, FwdPropsT>
impl<StateT: AgentState, FwdPropsT: FwdProps> Subscribers<StateT, FwdPropsT>
pub fn new( subscribers: Vec<Arc<dyn AgentSubscriber<StateT, FwdPropsT>>>, ) -> Self
Sourcepub fn from_subscriber<T>(subscriber: T) -> Selfwhere
T: AgentSubscriber<StateT, FwdPropsT> + 'static,
pub fn from_subscriber<T>(subscriber: T) -> Selfwhere
T: AgentSubscriber<StateT, FwdPropsT> + 'static,
Creates a new Subscribers collection from a single subscriber
Trait Implementations§
Source§impl<StateT: Clone + AgentState, FwdPropsT: Clone + FwdProps> Clone for Subscribers<StateT, FwdPropsT>
impl<StateT: Clone + AgentState, FwdPropsT: Clone + FwdProps> Clone for Subscribers<StateT, FwdPropsT>
Source§fn clone(&self) -> Subscribers<StateT, FwdPropsT>
fn clone(&self) -> Subscribers<StateT, FwdPropsT>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<StateT, FwdPropsT, T> FromIterator<T> for Subscribers<StateT, FwdPropsT>
impl<StateT, FwdPropsT, T> FromIterator<T> for Subscribers<StateT, FwdPropsT>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<'a, StateT, FwdPropsT> IntoIterator for &'a Subscribers<StateT, FwdPropsT>where
StateT: AgentState,
FwdPropsT: FwdProps,
impl<'a, StateT, FwdPropsT> IntoIterator for &'a Subscribers<StateT, FwdPropsT>where
StateT: AgentState,
FwdPropsT: FwdProps,
Source§impl<StateT, FwdPropsT> IntoSubscribers<StateT, FwdPropsT> for Subscribers<StateT, FwdPropsT>where
StateT: AgentState,
FwdPropsT: FwdProps,
impl<StateT, FwdPropsT> IntoSubscribers<StateT, FwdPropsT> for Subscribers<StateT, FwdPropsT>where
StateT: AgentState,
FwdPropsT: FwdProps,
fn into_subscribers(self) -> Subscribers<StateT, FwdPropsT>
Auto Trait Implementations§
impl<StateT, FwdPropsT> Freeze for Subscribers<StateT, FwdPropsT>
impl<StateT = Value, FwdPropsT = Value> !RefUnwindSafe for Subscribers<StateT, FwdPropsT>
impl<StateT, FwdPropsT> Send for Subscribers<StateT, FwdPropsT>
impl<StateT, FwdPropsT> Sync for Subscribers<StateT, FwdPropsT>
impl<StateT, FwdPropsT> Unpin for Subscribers<StateT, FwdPropsT>
impl<StateT = Value, FwdPropsT = Value> !UnwindSafe for Subscribers<StateT, FwdPropsT>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more