pub struct WorkHost { /* private fields */ }Expand description
Cloneable process-owned host for live work handles.
Rust Hara values are currently evaluator-thread values (Rc, not Send).
The host therefore schedules work cooperatively on that evaluator thread.
Submission only enqueues; polling or waiting on the result Promise, or an
explicit WorkHost::run, advances the run.
Implementations§
Source§impl WorkHost
impl WorkHost
pub fn new() -> Self
Sourcepub fn submit<F>(&self, id: Option<&str>, task: F) -> Result<WorkRun, String>
pub fn submit<F>(&self, id: Option<&str>, task: F) -> Result<WorkRun, String>
Submit work without executing it inline.
Sourcepub fn submit_rejection<F>(
&self,
id: Option<&str>,
task: F,
) -> Result<WorkRun, String>
pub fn submit_rejection<F>( &self, id: Option<&str>, task: F, ) -> Result<WorkRun, String>
Submit work whose executor already returns a native structured rejection.
pub fn submit_scoped<F>( &self, options: WorkOptions, task: F, ) -> Result<WorkRun, String>
pub fn submit_scoped_rejection<F>( &self, options: WorkOptions, task: F, ) -> Result<WorkRun, String>
Sourcepub fn resolve(&self, reference: &str) -> Result<WorkRun, String>
pub fn resolve(&self, reference: &str) -> Result<WorkRun, String>
Resolve a live handle from a portable raw identifier.
pub fn resolve_id(&self, id: &WorkId) -> Result<WorkRun, String>
Sourcepub fn run(&self, id: &WorkId) -> bool
pub fn run(&self, id: &WorkId) -> bool
Run one queued item by ID. Returns false when no runnable item remains.
pub fn run_next(&self) -> bool
pub fn drain(&self)
pub fn status(&self) -> WorkHostStatus
pub fn started(&self) -> bool
pub fn start(&self)
pub fn stop(&self)
pub fn kill(&self)
pub fn same_identity(&self, other: &Self) -> bool
Trait Implementations§
Source§impl IComponent for WorkHost
impl IComponent for WorkHost
Auto Trait Implementations§
impl !RefUnwindSafe for WorkHost
impl !Send for WorkHost
impl !Sync for WorkHost
impl !UnwindSafe for WorkHost
impl Freeze for WorkHost
impl Unpin for WorkHost
impl UnsafeUnpin for WorkHost
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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