Skip to main content

Crate dvm_run

Crate dvm_run 

Source
Expand description

dvm.run’s SDK: command sessions or supplied programs, and point-in-time inspection.

let client = dvm_run::Client::from_env()?;
let sandbox = client.create_sandbox("alpine:3.20").command(["echo", "hello"]).await?;
assert_eq!(sandbox.wait().await?, 0);
assert_eq!(sandbox.output().await?.stdout.bytes(), b"hello\n");
let point = sandbox.seek_end().await?;
println!("{:?}", point.stat("/etc/os-release").await?.kind);

Re-exports§

pub use dvm_api as api;

Structs§

Client
dvm.run’s API, at an address, as the user whose key it bears. Cheap to clone: clones share their connections.
Command
A started command. With omitted stdin the handle keeps it open.
CommandLine
Argv (an array or vector), or a shell script (a string).
CommandResult
A command’s bytes and exit code, or 128 + its killing signal. Nonzero is a result; the protocol cannot distinguish a signal from an explicit exit with that code.
LoggedIn
A login’s key, which save_key keeps where the SDK finds it.
RunBuilder
Options for a command run to its end. Omitted stdin is closed empty.
Sandbox
A sandbox, from Client::create_sandbox or Client::connect_sandbox. With neither command nor entrypoint it takes commands. Otherwise it is one run of the supplied program. Dropping it does not end or stop it.
SandboxBuilder
What a sandbox is made of: Client::create_sandbox, then what differs from 1 vCPU, 1024 MiB, seed 0, the image’s variables, and a name after the image; awaited, the sandbox, once it’s running.
SandboxPoint
SeekBuilder
StartBuilder
Options for starting a command, applied before awaiting it.
StatBuilder
StepBuilder
WriteFileBuilder

Enums§

Error
What the SDK returns when a call fails. A program’s exit code is never one of these.

Constants§

DEFAULT_API_URL

Functions§

credentials_path
Where the keys are saved.
login
Logs this machine in to dvm.run at api_url, else DVM_API_URL, else https://sandbox.dvm.run, once its user approves the login in their browser: the key it was given. say is told what to do; with open_browser, the page that approves it opens here.
save_key
Saves key for the dvm.run at api_url, in place of the one saved for it before; the file it’s in.

Type Aliases§

Result