Skip to main content

GuestFsOps

Trait GuestFsOps 

Source
pub trait GuestFsOps {
    // Required methods
    fn list_dir(
        &mut self,
        guest_path: &str,
    ) -> Result<Vec<String>, GuestFsError>;
    fn read_file(&mut self, guest_path: &str) -> Result<Vec<u8>, GuestFsError>;
    fn write_file(
        &mut self,
        guest_path: &str,
        data: &[u8],
    ) -> Result<(), GuestFsError>;
    fn mkdir(&mut self, guest_path: &str) -> Result<(), GuestFsError>;
    fn remove(&mut self, guest_path: &str) -> Result<(), GuestFsError>;
}
Expand description

Operations on the guest filesystem (Mode P). Paths are guest absolute paths (e.g. /workspace/foo).

Required Methods§

Source

fn list_dir(&mut self, guest_path: &str) -> Result<Vec<String>, GuestFsError>

List non-hidden names in guest_path (like ls -1A).

§Errors

Returns GuestFsError when guest_path is invalid or guest listing fails.

Source

fn read_file(&mut self, guest_path: &str) -> Result<Vec<u8>, GuestFsError>

Read a file by guest path.

§Errors

Returns GuestFsError when guest_path is invalid or reading fails.

Source

fn write_file( &mut self, guest_path: &str, data: &[u8], ) -> Result<(), GuestFsError>

Write or replace a file.

§Errors

Returns GuestFsError when path validation or write fails.

Source

fn mkdir(&mut self, guest_path: &str) -> Result<(), GuestFsError>

Create a directory (and parents), like mkdir -p.

§Errors

Returns GuestFsError when path validation or directory creation fails.

Source

fn remove(&mut self, guest_path: &str) -> Result<(), GuestFsError>

Remove a file or directory tree (rm -rf semantics on Lima; mock removes subtree).

§Errors

Returns GuestFsError when path validation or removal fails.

Implementors§

Source§

impl GuestFsOps for GammaSession

Available on Unix only.

GuestFsOps on the live γ session (used by REPL dispatch in guest-primary mode).

Source§

impl GuestFsOps for LimaGuestFsOps

Available on Unix only.
Source§

impl GuestFsOps for MockGuestFsOps