Struct async_progress::Progress [−][src]
pub struct Progress<State> where
State: 'static + Clone + Send + Sync + Eq + Debug, { /* fields omitted */ }
Expand description
Implementations
Create an event stream that will only fire for the given state. This is a stream and if you call
set_state
several times with the given state, this will yield several events.
Note that events fired before you call this will not be delivered to the stream. It’s recommended to
set up all observers first and then start doing work that can call set_state
.
Note that this method uses block_on
to lock a mutex on the pharos object, so it might block the
thread. All operations on Progress
are really short, so this shouldn’t be a problem as long as you
haven’t set up an observer by calling Progress::observe
with a bounded channel with a low queue size.
If the sending of an event (in set_state
) returns pending, and this method is called, that will deadlock.
Create a future that will resolve when a certain state is next triggered.
Note that events fired before you call this will not be delivered to the stream. It’s recommended to
set up all observers first and then start doing work that can call set_state
.
Note that this method uses block_on
to lock a mutex on the pharos object, so it might block the
thread. All operations on Progress
are really short, so this shouldn’t be a problem as long as you
haven’t set up an observer by calling Progress::observe
with a bounded channel with a low queue size.
If the sending of an event (in set_state
) returns pending, and this method is called, that will deadlock.
Trait Implementations
Avoid configuring pharos with a bounded channel of a low queue size. It is possible to create a
deadlock if the send in Progress::set_state
returns pending and you call another method on Progress
that uses block_on, notably Progress::current
.
Auto Trait Implementations
impl<State> !RefUnwindSafe for Progress<State>
impl<State> !UnwindSafe for Progress<State>
Blanket Implementations
Mutably borrows from an owned value. Read more