pub struct LocalProcessSandbox { /* private fields */ }Expand description
A Sandbox backed by the local file system and shell.
Provides no isolation. Paths resolve relative to root, but absolute
paths and .. are not blocked. Use only in tests and examples.
Implementations§
Source§impl LocalProcessSandbox
impl LocalProcessSandbox
Sourcepub fn new(root: impl Into<PathBuf>) -> Self
pub fn new(root: impl Into<PathBuf>) -> Self
Uses root as the working directory and the platform shell
(/bin/sh -c or cmd /C).
Sourcepub fn with_shell(
self,
program: impl Into<String>,
args: impl IntoIterator<Item = String>,
) -> Self
pub fn with_shell( self, program: impl Into<String>, args: impl IntoIterator<Item = String>, ) -> Self
Overrides the shell used to run commands (program followed by the arguments that precede the command line).
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Overrides the description.
Trait Implementations§
Source§impl Clone for LocalProcessSandbox
impl Clone for LocalProcessSandbox
Source§fn clone(&self) -> LocalProcessSandbox
fn clone(&self) -> LocalProcessSandbox
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LocalProcessSandbox
impl Debug for LocalProcessSandbox
Source§impl Sandbox for LocalProcessSandbox
impl Sandbox for LocalProcessSandbox
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable description added to agent instructions.
Source§fn read_file(
&self,
options: ReadFileOptions,
) -> BoxFuture<'_, Result<Option<ByteStream>>>
fn read_file( &self, options: ReadFileOptions, ) -> BoxFuture<'_, Result<Option<ByteStream>>>
Streams a file’s bytes.
Source§fn read_binary_file(
&self,
options: ReadFileOptions,
) -> BoxFuture<'_, Result<Option<Bytes>>>
fn read_binary_file( &self, options: ReadFileOptions, ) -> BoxFuture<'_, Result<Option<Bytes>>>
Reads a file into memory.
Source§fn read_text_file(
&self,
options: ReadTextFileOptions,
) -> BoxFuture<'_, Result<Option<String>>>
fn read_text_file( &self, options: ReadTextFileOptions, ) -> BoxFuture<'_, Result<Option<String>>>
Reads a text file, optionally a line range.
Source§fn write_file(
&self,
options: WriteFileOptions<ByteStream>,
) -> BoxFuture<'_, Result<()>>
fn write_file( &self, options: WriteFileOptions<ByteStream>, ) -> BoxFuture<'_, Result<()>>
Writes a file from a byte stream.
Source§fn write_binary_file(
&self,
options: WriteFileOptions<Bytes>,
) -> BoxFuture<'_, Result<()>>
fn write_binary_file( &self, options: WriteFileOptions<Bytes>, ) -> BoxFuture<'_, Result<()>>
Writes a file from bytes.
Source§fn write_text_file(
&self,
options: WriteFileOptions<String>,
) -> BoxFuture<'_, Result<()>>
fn write_text_file( &self, options: WriteFileOptions<String>, ) -> BoxFuture<'_, Result<()>>
Writes a text file.
Source§fn spawn(
&self,
options: ProcessOptions,
) -> BoxFuture<'_, Result<Box<dyn SandboxProcess>>>
fn spawn( &self, options: ProcessOptions, ) -> BoxFuture<'_, Result<Box<dyn SandboxProcess>>>
Starts a process.
Source§fn run(&self, options: ProcessOptions) -> BoxFuture<'_, Result<ProcessResult>>
fn run(&self, options: ProcessOptions) -> BoxFuture<'_, Result<ProcessResult>>
Runs a command to completion.
Auto Trait Implementations§
impl Freeze for LocalProcessSandbox
impl RefUnwindSafe for LocalProcessSandbox
impl Send for LocalProcessSandbox
impl Sync for LocalProcessSandbox
impl Unpin for LocalProcessSandbox
impl UnsafeUnpin for LocalProcessSandbox
impl UnwindSafe for LocalProcessSandbox
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