pub struct ExecuteOptions {
pub timeout: Option<Duration>,
pub cwd: Option<String>,
pub signal: Option<CancelSignal>,
pub env: Option<Vec<(String, String)>>,
}Expand description
Options for command and code execution (ExecuteOptions).
use std::time::Duration;
use strands::sandbox::ExecuteOptions;
let options = ExecuteOptions::builder()
.timeout(Duration::from_secs(30))
.cwd("/tmp")
.env([("GREETING", "hi")])
.build();
assert_eq!(options.env.unwrap(), [("GREETING".to_owned(), "hi".to_owned())]);Fields§
§timeout: Option<Duration>Maximum execution time. None means no timeout. When it elapses the process is killed and
execution fails with SandboxTimeoutError.
cwd: Option<String>Working directory for execution. None means the sandbox default.
signal: Option<CancelSignal>Cancels execution: the process is killed when the signal fires and execution fails with
SandboxAbortError.
env: Option<Vec<(String, String)>>Environment variables to set for this command, in order; for a repeated name the last
value applies. The built-in sandboxes always apply them; a custom Sandbox must apply
them itself or they have no effect.
Implementations§
Source§impl ExecuteOptions
impl ExecuteOptions
Sourcepub fn builder() -> ExecuteOptionsBuilder
pub fn builder() -> ExecuteOptionsBuilder
Create an instance of ExecuteOptions using the builder syntax
Trait Implementations§
Source§impl Clone for ExecuteOptions
impl Clone for ExecuteOptions
Source§impl Debug for ExecuteOptions
impl Debug for ExecuteOptions
Auto Trait Implementations§
impl Freeze for ExecuteOptions
impl RefUnwindSafe for ExecuteOptions
impl Send for ExecuteOptions
impl Sync for ExecuteOptions
impl Unpin for ExecuteOptions
impl UnsafeUnpin for ExecuteOptions
impl UnwindSafe for ExecuteOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreCreates a shared type from an unshared type.