Expand description
Rust SDK for Watasu.
The crate exposes a small async API for creating sandboxes, running
commands, and reading/writing files. Sandbox::create and
Sandbox::connect return only after the Watasu API has supplied a usable
data-plane session, so callers do not need to poll sandbox readiness.
use watasu::{CreateOptions, Sandbox};
let sandbox = Sandbox::create(CreateOptions::default()).await?;
sandbox.files.write("/home/user/a.py", "print(2 + 2)").await?;
let result = sandbox.commands.run("python /home/user/a.py").await?;
assert_eq!(result.stdout.trim(), "4");
sandbox.kill().await?;Structs§
- Command
Exit - Non-zero command exit information.
- Command
Handle - Live handle for one sandbox process stream.
- Command
Options - Options for starting a sandbox command.
- Command
Result - Completed command output.
- Commands
- Command runner for a sandbox data-plane session.
- Connection
Config - Resolved connection settings used by control-plane and data-plane clients.
- Connection
Options - Optional connection overrides accepted by SDK entrypoints.
- Create
Options - Options for
Sandbox::create. - Create
Snapshot Options - Options for creating a Watasu checkpoint.
- Entry
Info - Metadata for one sandbox filesystem entry.
- File
UrlInfo - Signed file URL metadata.
- File
UrlOptions - Options for signed file URL creation.
- Filesystem
- Filesystem helper for a sandbox data-plane session.
- Filesystem
Event - Filesystem event returned by a watch stream.
- Git
- Git helper backed by sandbox data-plane routes.
- GitAdd
Options - Options for staging files.
- GitBranches
- Branch list returned by
Git::branches. - GitClone
Options - Options for Git clone.
- GitCommand
Result - Result returned by a sandbox Git command.
- GitCommit
Options - Options for committing files.
- GitConfig
Options - Options for Git config operations.
- GitConfigure
User Options - Options for configuring Git user identity.
- GitCredential
Options - Options for Git credentials stored in the sandbox credential helper.
- GitDelete
Branch Options - Options for deleting a Git branch.
- GitFile
Status - Parsed status entry for one repository file.
- GitInit
Options - Options for initializing a Git repository.
- GitRemote
AddOptions - Options for adding a Git remote.
- GitRemote
Operation Options - Options for pulling or pushing.
- GitRequest
Options - Options shared by Git repository operations.
- GitReset
Options - Options for resetting Git state.
- GitRestore
Options - Options for restoring Git paths.
- GitStatus
- Parsed repository status.
- Process
Info - Metadata for one sandbox process.
- Process
Socket - Streaming WebSocket connection to the sandbox process runtime.
- Pty
- PTY helper backed by the sandbox process WebSocket runtime.
- PtyCreate
Options - Options for creating a PTY.
- PtySize
- PTY terminal size.
- Restore
Options - Options for restoring a checkpoint.
- Sandbox
- Running Watasu sandbox with ready
commandsandfileshelpers. - Sandbox
Info - Control-plane metadata for a sandbox.
- Sandbox
Metrics - Runtime metrics returned for a sandbox.
- Snapshot
Info - Watasu checkpoint metadata exposed with snapshot naming.
- Watch
Handle - Live filesystem watch stream.
- Watch
Options - Options for
Filesystem::watch_dir. - Write
Entry - File path and bytes used by
Filesystem::write_files.
Enums§
- Error
- Error type returned by Watasu SDK operations.
- File
Type - File type returned by sandbox filesystem metadata.
Constants§
- KEEPALIVE_
PING_ INTERVAL_ SECS - WebSocket keepalive interval used by command streams.
Functions§
- decode_
runtime_ data - Decode base64 stdout/stderr frame data from the sandbox runtime protocol.
- encode_
runtime_ data - Encode stdin bytes for the sandbox runtime protocol.