pub struct PluginSandbox { /* private fields */ }Expand description
Wraps plugin execution with policy enforcement.
PluginSandbox owns a SandboxContext and exposes helpers that callers
should invoke before performing resource-consuming operations within the
plugin’s execution boundary.
Implementations§
Source§impl PluginSandbox
impl PluginSandbox
Sourcepub fn new(config: SandboxConfig) -> Self
pub fn new(config: SandboxConfig) -> Self
Create a new sandbox from a SandboxConfig.
Sourcepub fn context(&self) -> &SandboxContext
pub fn context(&self) -> &SandboxContext
Obtain a reference to the inner context.
Sourcepub fn run<F, T>(&self, f: F) -> Result<T, SandboxError>
pub fn run<F, T>(&self, f: F) -> Result<T, SandboxError>
Run f inside the sandbox, checking the timeout on entry.
§Errors
Returns SandboxError::Timeout if the wall-clock limit is exceeded before
f is even called. Errors from f are propagated unchanged.
Auto Trait Implementations§
impl !Freeze for PluginSandbox
impl RefUnwindSafe for PluginSandbox
impl Send for PluginSandbox
impl Sync for PluginSandbox
impl Unpin for PluginSandbox
impl UnsafeUnpin for PluginSandbox
impl UnwindSafe for PluginSandbox
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
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>
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