pub struct Sandbox {
pub id: SandboxId,
pub config: SandboxConfig,
pub state: SandboxState,
pub created_at: DateTime<Utc>,
pub started_at: Option<DateTime<Utc>>,
pub stopped_at: Option<DateTime<Utc>>,
/* private fields */
}Expand description
A sandbox instance with lifecycle management.
Fields§
§id: SandboxIdUnique identifier for this sandbox.
config: SandboxConfigConfiguration used to create this sandbox.
state: SandboxStateCurrent lifecycle state.
created_at: DateTime<Utc>Timestamp when the sandbox was created.
started_at: Option<DateTime<Utc>>Timestamp when the sandbox entered the Running state.
stopped_at: Option<DateTime<Utc>>Timestamp when the sandbox was stopped or destroyed.
Implementations§
Source§impl Sandbox
impl Sandbox
Sourcepub async fn create(config: SandboxConfig) -> Result<Self>
pub async fn create(config: SandboxConfig) -> Result<Self>
Create a new sandbox (does not start it).
Sourcepub fn transition(&mut self, to: SandboxState) -> Result<()>
pub fn transition(&mut self, to: SandboxState) -> Result<()>
Transition to a new state.
Sourcepub async fn exec(&self, command: &str) -> Result<ExecResult>
pub async fn exec(&self, command: &str) -> Result<ExecResult>
Execute a command — delegates to the backend, then applies externalization gate.
Sourcepub async fn spawn(&self, command: &str) -> Result<SpawnedProcess>
pub async fn spawn(&self, command: &str) -> Result<SpawnedProcess>
Spawn a long-running command in the sandbox.
Unlike exec, this returns immediately with a handle to the running process.
The caller is responsible for managing the process lifecycle.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sandbox
impl !RefUnwindSafe for Sandbox
impl Send for Sandbox
impl Sync for Sandbox
impl Unpin for Sandbox
impl UnsafeUnpin for Sandbox
impl !UnwindSafe for Sandbox
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