pub struct Subscription<Msg> { /* private fields */ }Expand description
A set of continuous message sources, possibly empty.
Implementations§
Source§impl<Msg: Send + 'static> Subscription<Msg>
impl<Msg: Send + 'static> Subscription<Msg>
Sourcepub fn batch(subscriptions: impl IntoIterator<Item = Subscription<Msg>>) -> Self
pub fn batch(subscriptions: impl IntoIterator<Item = Subscription<Msg>>) -> Self
Groups several subscriptions together.
Sourcepub fn every(
interval: Duration,
make: impl Fn(Instant) -> Msg + Send + 'static,
) -> Self
pub fn every( interval: Duration, make: impl Fn(Instant) -> Msg + Send + 'static, ) -> Self
Emits a message every interval; the tick’s Instant is passed along.
Sourcepub fn every_keyed(
key: u64,
interval: Duration,
make: impl Fn(Instant) -> Msg + Send + 'static,
) -> Self
pub fn every_keyed( key: u64, interval: Duration, make: impl Fn(Instant) -> Msg + Send + 'static, ) -> Self
Subscription::every under an identity of the caller’s: two timers of the same period
are two subscriptions when their keys differ, and one that keeps its key from one cycle
to the next keeps running.
Auto Trait Implementations§
impl<Msg> !RefUnwindSafe for Subscription<Msg>
impl<Msg> !Sync for Subscription<Msg>
impl<Msg> !UnwindSafe for Subscription<Msg>
impl<Msg> Freeze for Subscription<Msg>
impl<Msg> Send for Subscription<Msg>
impl<Msg> Unpin for Subscription<Msg>
impl<Msg> UnsafeUnpin for Subscription<Msg>where
Vec<Entry<Msg>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.