Skip to main content

TaskHandle

Struct TaskHandle 

Source
pub struct TaskHandle(/* private fields */);
Expand description

A cloneable, shareable handle to an optional GantzTask, suitable for storage in node state or transfer along graph edges as an opaque SteelVal.

Cloning shares the underlying cell. Steel’s FromSteelVal for custom types clones, so a handle extracted from the VM still refers to the same task. The result is delivered exactly once. TaskHandle::check consumes the result on completion. When several holders share the cell, only the first holder checked after completion delivers. The rest observe None. TaskHandle::take and TaskHandle::cancel remove the task from every clone at once.

Implementations§

Source§

impl TaskHandle

Source

pub fn new(task: GantzTask) -> Self

Wrap a task in a fresh shareable handle.

Source

pub fn take(&self) -> Option<GantzTask>

Take the task out of the handle, leaving None for every clone.

Source

pub fn check(&self) -> Option<Result<SteelVal, String>>

Check the contained task in place, leaving it in the handle.

Returns None while pending, after the result has been delivered, or when the handle was taken or cancelled.

Source

pub fn cancel(&self) -> bool

Drop the contained task, cancelling it for every clone.

Returns whether a task was present to cancel.

Trait Implementations§

Source§

impl Clone for TaskHandle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Custom for TaskHandle

Source§

fn fmt(&self) -> Option<Result<String, Error>>

Source§

fn into_serializable_steelval(&mut self) -> Option<SerializableSteelVal>

Source§

fn as_iterator(&self) -> Option<Box<dyn Iterator<Item = SteelVal>>>

Source§

fn gc_drop_mut(&mut self, _drop_handler: &mut IterativeDropHandler<'_>)

Source§

fn gc_visit_children(&self, _context: &mut MarkAndSweepContext<'_>)

Source§

fn visit_equality(&self, _visitor: &mut EqualityVisitor<'_>)

Source§

fn equality_hint(&self, _other: &dyn CustomType) -> bool

Source§

fn equality_hint_general(&self, _other: &SteelVal) -> bool

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsRefMutSteelVal for T

Source§

fn as_mut_ref<'b, 'a>(val: &'a SteelVal) -> Result<RefMut<'b, T>, SteelErr>
where 'a: 'b,

Source§

impl<T> AsRefSteelVal for T

Source§

type Nursery = ()

Source§

fn as_ref<'b, 'a>(val: &'a SteelVal) -> Result<SRef<'b, T>, SteelErr>
where 'a: 'b,

Source§

impl<T> AsRefSteelValFromUnsized<T> for T
where T: FromSteelVal + Clone,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CustomType for T

Source§

fn as_any_ref(&self) -> &(dyn Any + 'static)

Source§

fn as_any_ref_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

fn inner_type_id(&self) -> TypeId

Source§

fn display(&self) -> Result<String, Error>

Source§

fn as_serializable_steelval(&mut self) -> Option<SerializableSteelVal>

Source§

fn drop_mut(&mut self, drop_handler: &mut IterativeDropHandler<'_>)

Source§

fn visit_children(&self, context: &mut MarkAndSweepContext<'_>)

Source§

fn visit_children_for_equality(&self, visitor: &mut EqualityVisitor<'_>)

Source§

fn check_equality_hint(&self, other: &dyn CustomType) -> bool

Source§

fn check_equality_hint_general(&self, other: &SteelVal) -> bool

Source§

fn into_error_(self) -> Result<SteelErr, T>
where T: Sized,

Source§

fn name(&self) -> &str

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromSteelVal for T
where T: CustomType + Clone + 'static,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<T> IntoSteelVal for T
where T: CustomType + 'static,

Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> MaybeSendSyncStatic for T
where T: 'static,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more