pub struct ScopedSandboxExecutor { /* private fields */ }Expand description
Runs Sandbox::StoreScoped tools on a confined scoped thread.
Implementations§
Source§impl ScopedSandboxExecutor
impl ScopedSandboxExecutor
Sourcepub fn new(
restrict: impl Fn() -> Result<(), String> + Send + Sync + 'static,
) -> Self
pub fn new( restrict: impl Fn() -> Result<(), String> + Send + Sync + 'static, ) -> Self
Build with the caller’s confinement callback.
The dispatch timeout defaults to
crate::DispatchPipeline::timeout_from_env (WM_DISPATCH_TIMEOUT_MS),
matching the normal dispatch path; Self::with_timeout overrides it.
Sourcepub const fn with_timeout(self, timeout: Option<Duration>) -> Self
pub const fn with_timeout(self, timeout: Option<Duration>) -> Self
Override the dispatch timeout (None disables the bound).
Sourcepub fn stats(&self) -> (u64, u64, u64)
pub fn stats(&self) -> (u64, u64, u64)
(runs, degraded runs, contained panics/runtime failures).
Sourcepub fn run(
&self,
tool: &dyn Tool,
ctx: &mut Context,
args: Args,
) -> Result<Output>
pub fn run( &self, tool: &dyn Tool, ctx: &mut Context, args: Args, ) -> Result<Output>
Execute one tool call on a confined thread.
Synchronous by design: the dispatcher blocks while the confined
thread runs. The configured dispatch timeout is applied inside the
confined thread — a timed-out tool future is dropped and reported as
a CoreError::Tool, mirroring the normal dispatch path. Panics
inside the tool are contained by the scoped thread and surface as a
CoreError::Tool — the process survives.
Auto Trait Implementations§
impl !Freeze for ScopedSandboxExecutor
impl !RefUnwindSafe for ScopedSandboxExecutor
impl !UnwindSafe for ScopedSandboxExecutor
impl Send for ScopedSandboxExecutor
impl Sync for ScopedSandboxExecutor
impl Unpin for ScopedSandboxExecutor
impl UnsafeUnpin for ScopedSandboxExecutor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§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