[][src]Struct broot::task_sync::Dam

pub struct Dam { /* fields omitted */ }

The dam controls the flow of events. A dam is used in broot to manage long computations and, when the user presses a key, either tell the computation to stop (the computation function checking has_event) or drop the computation.

Implementations

impl Dam[src]

pub fn from(receiver: Receiver<Event>) -> Self[src]

pub fn unlimited() -> Self[src]

pub fn observer(&self) -> DamObserver[src]

provide an observer which can be used for periodic check a task can be used. The observer can safely be moved to another thread but Be careful not to use it after the event listener started again. In any case using try_compute should be prefered for immediate return to the ui thread.

pub fn try_compute<V: Send + 'static, F: Send + 'static + FnOnce() -> ComputationResult<V>>(
    &mut self,
    f: F
) -> ComputationResult<V>
[src]

launch the computation on a new thread and return when it finishes or when a new event appears on the channel

pub fn select<V>(
    &mut self,
    comp_receiver: Receiver<ComputationResult<V>>
) -> ComputationResult<V>
[src]

pub fn has_event(&self) -> bool[src]

non blocking

pub fn next_event(&mut self) -> Option<Event>[src]

block until next event (including the one which may have been pushed back into the dam). no event means the source is dead (i.e. we must quit broot) There's no event kept in dam after this call.

Auto Trait Implementations

impl RefUnwindSafe for Dam

impl Send for Dam

impl Sync for Dam

impl Unpin for Dam

impl UnwindSafe for Dam

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.