pub struct ExecutionHandle { /* private fields */ }Expand description
Handle to a cancellable execution.
Created by Sandbox::execute_cancellable. Use this handle to cancel
the execution or wait for its completion.
The handle can be cloned to share cancellation control across tasks.
Implementations§
Source§impl ExecutionHandle
impl ExecutionHandle
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Cancel the execution.
This signals the WASM runtime to interrupt execution. The cancellation is asynchronous - the execution may not stop immediately, especially if it’s currently in a host callback.
Calling cancel multiple times has no additional effect.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the execution is still running.
Returns false if the execution has completed (successfully or with error)
or if it has been cancelled.
Sourcepub fn cancellation_token(&self) -> CancellationToken
pub fn cancellation_token(&self) -> CancellationToken
Get a clone of the cancellation token.
This is useful for integrating with other cancellation-aware code.
Sourcepub async fn wait(self) -> Result<ExecuteResult, Error>
pub async fn wait(self) -> Result<ExecuteResult, Error>
Wait for the execution to complete.
Returns the execution result or an error. If the execution was cancelled,
returns Error::Cancelled.
§Errors
Returns an error if:
- The execution was cancelled (
Error::Cancelled) - The Python code raised an exception
- A resource limit was exceeded
- The execution timed out
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ExecutionHandle
impl !UnwindSafe for ExecutionHandle
impl Freeze for ExecutionHandle
impl Send for ExecutionHandle
impl Sync for ExecutionHandle
impl Unpin for ExecutionHandle
impl UnsafeUnpin for ExecutionHandle
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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