pub struct Jobs<R: Resource> { /* private fields */ }Expand description
Work a view or surface starts on its own, with nobody invoking an
effect: a route fetched when the destination changes, a feed refreshed
when it opens. Each job runs under a key; starting another under a key
still running stops the earlier one, so the latest request wins. A job
is started like an effect’s (EffectCx::thread, EffectCx::spawn)
and finishes the same way, on the UI thread, with ordinary actions; a
surface’s completion gets &mut the surface. Jobs run only in a window
someone uses: a past version and a capture start none.
Get one from SurfaceCx::jobs or
ViewCx::jobs. Clones share the jobs.
Implementations§
Source§impl<R: Resource> Jobs<R>
impl<R: Resource> Jobs<R>
Sourcepub fn start<H: 'static>(
&self,
key: impl Into<String>,
start: impl FnOnce(&mut EffectCx<R, H>) -> EffectAnswer,
)
pub fn start<H: 'static>( &self, key: impl Into<String>, start: impl FnOnce(&mut EffectCx<R, H>) -> EffectAnswer, )
Start the job key as start does it, through an EffectCx whose
completions get &mut H: the surface itself for a surface’s jobs
(jobs.start::<Self>(…)), () for a view’s. Work it finishes at
once needs no job; a failure is logged, as nobody waits for it.
Sourcepub fn is_running(&self, key: &str) -> bool
pub fn is_running(&self, key: &str) -> bool
Whether the job key is still running.
Sourcepub fn progress(&self, key: &str) -> Option<JobProgress>
pub fn progress(&self, key: &str) -> Option<JobProgress>
Where the running job key last said it is, for the view to show
and publish; None before its first report and once it ended.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for Jobs<R>
impl<R> !RefUnwindSafe for Jobs<R>
impl<R> !Send for Jobs<R>
impl<R> !Sync for Jobs<R>
impl<R> Unpin for Jobs<R>
impl<R> UnsafeUnpin for Jobs<R>
impl<R> !UnwindSafe for Jobs<R>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more