pub struct PipetteClient { /* private fields */ }Expand description
A client to a running pipette instance inside a VM.
Implementations§
Source§impl PipetteClient
impl PipetteClient
Sourcepub async fn new(
spawner: impl Spawn,
conn: impl 'static + AsyncRead + AsyncWrite + Send + Unpin,
output_dir: &Path,
) -> Result<Self, RecvError>
pub async fn new( spawner: impl Spawn, conn: impl 'static + AsyncRead + AsyncWrite + Send + Unpin, output_dir: &Path, ) -> Result<Self, RecvError>
Connects to a pipette instance inside a VM.
conn must be an established connection over some byte stream (e.g., a
socket).
Sourcepub fn windows_shell(&self) -> WindowsShell<'_>
pub fn windows_shell(&self) -> WindowsShell<'_>
Return a shell object to interact with a Windows guest.
Sourcepub fn unix_shell(&self) -> UnixShell<'_>
pub fn unix_shell(&self) -> UnixShell<'_>
Return a shell object to interact with a Linux guest.
Sourcepub fn command(&self, program: impl AsRef<str>) -> Command<'_>
pub fn command(&self, program: impl AsRef<str>) -> Command<'_>
Returns an object used to launch a command inside the guest.
TODO: this is a low-level interface. Make a high-level interface like
xshell::Shell for manipulating the environment and launching
processes.
Sourcepub async fn read_file(&self, path: impl AsRef<str>) -> Result<Vec<u8>>
pub async fn read_file(&self, path: impl AsRef<str>) -> Result<Vec<u8>>
Reads the full contents of a file.
Sourcepub async fn write_file(
&self,
path: impl AsRef<str>,
contents: impl AsyncRead,
) -> Result<()>
pub async fn write_file( &self, path: impl AsRef<str>, contents: impl AsyncRead, ) -> Result<()>
Writes a file to the guest. Note: This may transfer the file in chunks. It is likely not suitable for writing to files that require all content to be written at once, e.g. files in /proc or /sys.
Sourcepub async fn kernel_crash(&self) -> Result<(), RemoteError>
pub async fn kernel_crash(&self) -> Result<(), RemoteError>
Tell the agent to crash the kernel.
Auto Trait Implementations§
impl Freeze for PipetteClient
impl !RefUnwindSafe for PipetteClient
impl Send for PipetteClient
impl Sync for PipetteClient
impl Unpin for PipetteClient
impl !UnwindSafe for PipetteClient
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