Trait Event

Source
pub trait Event<T> {
    // Required methods
    fn listen(&self) -> BoxFuture<'static, T>;
    fn clone_dyn(&self) -> Box<dyn Event<T>>;
}
Expand description

The Event trait defines an object that can be used as an Event

This is a trait that defines the listen function that returns a future so that it can be used in async code.

use futures::future::BoxFuture;
pub trait Event<T> {
    fn listen(&self) -> BoxFuture<'static, T>;
}

Required Methods§

Source

fn listen(&self) -> BoxFuture<'static, T>

Source

fn clone_dyn(&self) -> Box<dyn Event<T>>

Allow cloning of Boxed elements of vector for AllOf/AnyOf

See stack overflow post

Trait Implementations§

Source§

impl<T> Clone for Box<dyn Event<T>>

Provide Clone implementation for boxed Event

Source§

fn clone(self: &Box<dyn Event<T>>) -> Box<dyn Event<T>>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§

Source§

impl<T> Event<T> for AllOf<T>
where T: Default + 'static,

Source§

impl<T> Event<T> for AnyOf<T>
where T: 'static,

Source§

impl<T> Event<T> for Once<T>
where T: Copy + 'static,

Source§

impl<T> Event<T> for Repeated<T>
where T: Copy + 'static,