Skip to main content

Sandbox

Struct Sandbox 

Source
pub struct Sandbox { /* private fields */ }
Expand description

A handle on one sandbox.

Implementations§

Source§

impl Sandbox

Source

pub fn create(client: &Client, spec: &SandboxSpec) -> Result<Sandbox>

Create and start a new sandbox; fails if it already exists. Relative bind paths resolve against the current directory.

Source

pub fn create_with( client: &Client, spec: &SandboxSpec, defs: &VolumeDefs, opts: EnsureOptions, report: Reporter<'_>, ) -> Result<Sandbox>

Source

pub fn connect_or_create(client: &Client, spec: &SandboxSpec) -> Result<Sandbox>

Reconcile a sandbox to spec, creating it if needed: only what differs is changed, and a correct device is never touched.

Source

pub fn connect_or_create_with( client: &Client, spec: &SandboxSpec, defs: &VolumeDefs, opts: EnsureOptions, report: Reporter<'_>, ) -> Result<(Sandbox, ApplyReport)>

Source

pub fn connect_or_create_with_base( client: &Client, spec: &SandboxSpec, defs: &VolumeDefs, base: &Path, opts: EnsureOptions, report: Reporter<'_>, ) -> Result<(Sandbox, ApplyReport)>

Sandbox::connect_or_create_with, with relative bind paths resolving against base instead of the current directory.

Source

pub fn get(client: &Client, name: &str) -> Result<Sandbox>

Handle on an existing sandbox.

Source

pub fn list(client: &Client) -> Result<Vec<SandboxInfo>>

All instances in the client’s project.

Source

pub fn list_with( client: &Client, labels: &[LabelFilter], ) -> Result<Vec<SandboxInfo>>

Instances whose labels match every filter.

Source

pub fn remove(client: &Client, name: &str, force: bool) -> Result<()>

Delete a sandbox. A running one needs force (it is stopped first).

Source

pub fn name(&self) -> &str

Source

pub fn client(&self) -> &Client

Source

pub fn with_exec_defaults(self, d: ExecDefaults) -> Self

Use these exec defaults for this handle.

Source

pub fn info(&self) -> Result<SandboxInfo>

Source

pub fn labels(&self) -> Result<BTreeMap<String, String>>

Source

pub fn start(&self) -> Result<()>

Source

pub fn stop(&self, force: bool, timeout: Duration) -> Result<()>

Stop. force kills instead of a clean shutdown; timeout bounds the clean shutdown.

Source

pub fn restart(&self) -> Result<()>

Source

pub fn wait_ready(&self) -> Result<()>

Run this handle’s readiness checks.

Source

pub fn exec<I, S>(&self, argv: I) -> Result<ExecOutput>
where I: IntoIterator<Item = S>, S: Into<String>,

Run a command and capture its output. argv[0] is the program; nothing is joined into a shell string.

Source

pub fn exec_with<I, S>(&self, argv: I, opts: ExecOptions) -> Result<ExecOutput>
where I: IntoIterator<Item = S>, S: Into<String>,

Source

pub fn exec_stream<I, S>( &self, argv: I, opts: ExecOptions, ) -> Result<ExecStream>
where I: IntoIterator<Item = S>, S: Into<String>,

Start a command and stream its output as it is produced.

Source

pub fn attach<I, S>(&self, argv: I, opts: ExecOptions) -> Result<i32>
where I: IntoIterator<Item = S>, S: Into<String>,

Run attached to this process’s stdio (and terminal, with opts.tty), forwarding signals. Returns the exit code.

Source

pub fn add_port(&self, port: &PortSpec) -> Result<String>

Add (or correct) a proxy device. Host-bound ports with search step past taken ports. Returns the listen address in use. A correct device is left untouched.

Source

pub fn remove_device(&self, device: &str) -> Result<bool>

Remove an instance-local device. Ok(false) if it was not there.

Trait Implementations§

Source§

impl Clone for Sandbox

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Sandbox

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V