Struct hotshot_task::dependency::EventDependency
source · pub struct EventDependency<T: Clone + Send + Sync> {
pub(crate) event_rx: Receiver<T>,
pub(crate) match_fn: Box<dyn Fn(&T) -> bool + Send>,
completed_dependency: Option<T>,
}
Expand description
A dependency that listens on a channel for an event that matches what some value it wants.
Fields§
§event_rx: Receiver<T>
Channel of incoming events
match_fn: Box<dyn Fn(&T) -> bool + Send>
Closure which returns true if the incoming T
is the
thing that completes this dependency
completed_dependency: Option<T>
The potentially externally completed dependency. If the dependency was seeded from an event message, we can mark it as already done in lieu of other events still pending.
Implementations§
Trait Implementations§
source§impl<T: Clone + Send + Sync + 'static> Dependency<T> for EventDependency<T>
impl<T: Clone + Send + Sync + 'static> Dependency<T> for EventDependency<T>
source§async fn completed(self) -> Option<T>
async fn completed(self) -> Option<T>
Complete will wait until it gets some value
T
then return the valuesource§fn or<D: Dependency<T> + Send + 'static>(self, dep: D) -> OrDependency<T>
fn or<D: Dependency<T> + Send + 'static>(self, dep: D) -> OrDependency<T>
Create an or dependency from this dependency and another
Auto Trait Implementations§
impl<T> Freeze for EventDependency<T>where
T: Freeze,
impl<T> !RefUnwindSafe for EventDependency<T>
impl<T> Send for EventDependency<T>
impl<T> !Sync for EventDependency<T>
impl<T> Unpin for EventDependency<T>where
T: Unpin,
impl<T> !UnwindSafe for EventDependency<T>
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