pub struct Remote { /* private fields */ }Implementations§
Source§impl Remote
impl Remote
pub fn new(cfg: RemoteConfig, limits: Limits) -> Self
pub fn host(&self) -> &str
Sourcepub fn address(&self) -> Address
pub fn address(&self) -> Address
How the remote is addressed from this machine, as OpenSSH resolves
the destination: (hostname, port). The model needs this to report
URLs the user can open; an alias from ~/.ssh/config means nothing
to a browser. Falls back to the configured destination.
Sourcepub async fn effective_workdir(&self) -> Result<String>
pub async fn effective_workdir(&self) -> Result<String>
The workdir with ~ expanded; connects if needed.
pub fn limits(&self) -> &Limits
pub async fn is_connected(&self) -> bool
Sourcepub async fn resolve(&self, raw: &str) -> Result<String>
pub async fn resolve(&self, raw: &str) -> Result<String>
Absolute remote path for what the model typed: ~ expands to the
remote home, relative paths hang off the working directory.
Sourcepub async fn exec(
&self,
command: &str,
cwd: Option<&str>,
timeout_secs: Option<u64>,
) -> Result<ExecOutput>
pub async fn exec( &self, command: &str, cwd: Option<&str>, timeout_secs: Option<u64>, ) -> Result<ExecOutput>
Run command through the configured shell in cwd (default: the
working directory). timeout_secs is clamped to the configured
maximum.
Sourcepub async fn read_file(&self, path: &str, max: usize) -> Result<(Vec<u8>, u64)>
pub async fn read_file(&self, path: &str, max: usize) -> Result<(Vec<u8>, u64)>
Read at most max bytes of a remote file. Returns the bytes and the
file’s full length.
Sourcepub async fn write_file(&self, path: &str, content: &[u8]) -> Result<String>
pub async fn write_file(&self, path: &str, content: &[u8]) -> Result<String>
Write a whole file, creating parent directories.
pub async fn exists(&self, path: &str) -> Result<Option<bool>>
Auto Trait Implementations§
impl !Freeze for Remote
impl !RefUnwindSafe for Remote
impl !UnwindSafe for Remote
impl Send for Remote
impl Sync for Remote
impl Unpin for Remote
impl UnsafeUnpin for Remote
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