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

pub struct Dam { /* fields omitted */ }
Expand description

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

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.

launch the computation on a new thread and return when it finishes or when a new event appears on the channel. Note that the task itself isn’t interrupted so that this should not be used when many tasks are expected to be launched (or it would result in many working threads uselessly working in the background) : use dam.has_event from inside the task whenever possible.

non blocking

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.