pub struct Thread<'gc>(/* private fields */);Implementations§
Source§impl<'gc> Thread<'gc>
impl<'gc> Thread<'gc>
pub fn new(ctx: Context<'gc>) -> Thread<'gc>
pub fn from_inner(inner: Gc<'gc, ThreadInner<'gc>>) -> Self
pub fn into_inner(self) -> Gc<'gc, ThreadInner<'gc>>
pub fn mode(self) -> ThreadMode
Sourcepub fn start(
self,
ctx: Context<'gc>,
function: Function<'gc>,
args: impl IntoMultiValue<'gc>,
) -> Result<(), BadThreadMode>
pub fn start( self, ctx: Context<'gc>, function: Function<'gc>, args: impl IntoMultiValue<'gc>, ) -> Result<(), BadThreadMode>
If this thread is Stopped, start a new function with the given arguments.
Sourcepub fn start_suspended(
self,
mc: &Mutation<'gc>,
function: Function<'gc>,
) -> Result<(), BadThreadMode>
pub fn start_suspended( self, mc: &Mutation<'gc>, function: Function<'gc>, ) -> Result<(), BadThreadMode>
If this thread is Stopped, start a new suspended function.
Sourcepub fn take_result<T: FromMultiValue<'gc>>(
self,
ctx: Context<'gc>,
) -> Result<Result<T, Error<'gc>>, BadThreadMode>
pub fn take_result<T: FromMultiValue<'gc>>( self, ctx: Context<'gc>, ) -> Result<Result<T, Error<'gc>>, BadThreadMode>
If the thread is in the Result mode, take the returned (or yielded) values. Moves the
thread back to the Stopped (or Suspended) mode.
Sourcepub fn resume(
self,
ctx: Context<'gc>,
args: impl IntoMultiValue<'gc>,
) -> Result<(), BadThreadMode>
pub fn resume( self, ctx: Context<'gc>, args: impl IntoMultiValue<'gc>, ) -> Result<(), BadThreadMode>
If the thread is in Suspended mode, resume it.
Sourcepub fn resume_err(
self,
mc: &Mutation<'gc>,
error: Error<'gc>,
) -> Result<(), BadThreadMode>
pub fn resume_err( self, mc: &Mutation<'gc>, error: Error<'gc>, ) -> Result<(), BadThreadMode>
If the thread is in Suspended mode, cause an error wherever the thread was suspended.
Trait Implementations§
Source§impl<'gc> Collect for Thread<'gc>
impl<'gc> Collect for Thread<'gc>
Source§fn needs_trace() -> bool
fn needs_trace() -> bool
As an optimization, if this type can never hold a
Gc pointer and trace is unnecessary
to call, you may implement this method and return false. The default implementation returns
true, signaling that Collect::trace must be called.Source§fn trace(&self, cc: &Collection)
fn trace(&self, cc: &Collection)
Must call
Collect::trace on all held Gc pointers. If this type holds inner types that
implement Collect, a valid implementation would simply call Collect::trace on all the
held values to ensure this.Source§impl<'a, 'gc> IntoValue<'gc> for &'a Thread<'gc>
impl<'a, 'gc> IntoValue<'gc> for &'a Thread<'gc>
fn into_value(self, ctx: Context<'gc>) -> Value<'gc>
Source§impl<'gc> IntoValue<'gc> for Thread<'gc>
impl<'gc> IntoValue<'gc> for Thread<'gc>
fn into_value(self, _: Context<'gc>) -> Value<'gc>
Source§impl<'gc> Stashable<'gc> for Thread<'gc>
impl<'gc> Stashable<'gc> for Thread<'gc>
type Stashed = StashedThread
fn stash(self, roots: &DynamicRootSet<'gc>, mc: &Mutation<'gc>) -> Self::Stashed
impl<'gc> Copy for Thread<'gc>
impl<'gc> Eq for Thread<'gc>
Auto Trait Implementations§
impl<'gc> Freeze for Thread<'gc>
impl<'gc> !RefUnwindSafe for Thread<'gc>
impl<'gc> !Send for Thread<'gc>
impl<'gc> !Sync for Thread<'gc>
impl<'gc> Unpin for Thread<'gc>
impl<'gc> !UnwindSafe for Thread<'gc>
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