Struct broot::task_sync::Dam [−][src]
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]
&mut self,
f: F
) -> ComputationResult<V>
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.
pub fn select<V>(
&mut self,
comp_receiver: Receiver<ComputationResult<V>>
) -> ComputationResult<V>
[src]
&mut self,
comp_receiver: Receiver<ComputationResult<V>>
) -> ComputationResult<V>
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.
pub fn next<T>(
&mut self,
other: &Receiver<T>
) -> Either<Option<Event>, Option<T>>
[src]
&mut self,
other: &Receiver<T>
) -> Either<Option<Event>, Option<T>>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,