Struct distant_core::SessionChannel
source · [−]pub struct SessionChannel { /* private fields */ }
Expand description
Represents a sender of requests tied to a session, holding onto a weak reference of
mailboxes to relay responses, meaning that once the Session
is closed or dropped,
any sent request will no longer be able to receive responses
Implementations
sourceimpl SessionChannel
impl SessionChannel
sourcepub async fn mail(&mut self, req: Request) -> Result<Mailbox, TransportError>
pub async fn mail(&mut self, req: Request) -> Result<Mailbox, TransportError>
Sends a request and returns a mailbox that can receive one or more responses, failing if unable to send a request or if the session’s receiving line to the remote server has already been severed
sourcepub async fn send(&mut self, req: Request) -> Result<Response, TransportError>
pub async fn send(&mut self, req: Request) -> Result<Response, TransportError>
Sends a request and waits for a response, failing if unable to send a request or if the session’s receiving line to the remote server has already been severed
sourcepub async fn send_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<Response, TransportError>
pub async fn send_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<Response, TransportError>
Sends a request and waits for a response, timing out after duration has passed
sourcepub async fn fire(&mut self, req: Request) -> Result<(), TransportError>
pub async fn fire(&mut self, req: Request) -> Result<(), TransportError>
Sends a request without waiting for a response; this method is able to be used even if the session’s receiving line to the remote server has been severed
sourcepub async fn fire_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<(), TransportError>
pub async fn fire_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<(), TransportError>
Sends a request without waiting for a response, timing out after duration has passed
Trait Implementations
sourceimpl Clone for SessionChannel
impl Clone for SessionChannel
sourcefn clone(&self) -> SessionChannel
fn clone(&self) -> SessionChannel
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl From<Session> for SessionChannel
impl From<Session> for SessionChannel
sourceimpl SessionChannelExt for SessionChannel
impl SessionChannelExt for SessionChannel
sourcefn append_file(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
data: impl Into<Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
fn append_file(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
data: impl Into<Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
Appends to a remote file using the data from a collection of bytes
sourcefn append_file_text(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
data: impl Into<String>
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
fn append_file_text(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
data: impl Into<String>
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
Appends to a remote file using the data from a string
sourcefn copy(
&mut self,
tenant: impl Into<String>,
src: impl Into<PathBuf>,
dst: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
fn copy(
&mut self,
tenant: impl Into<String>,
src: impl Into<PathBuf>,
dst: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
Copies a remote file or directory from src to dst
sourcefn create_dir(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
all: bool
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
fn create_dir(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
all: bool
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
Creates a remote directory, optionally creating all parent components if specified
sourcefn exists(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<bool, SessionChannelExtError>> + Send + '_>>
fn exists(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<bool, SessionChannelExtError>> + Send + '_>>
Checks if a path exists on a remote machine
sourcefn metadata(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
canonicalize: bool,
resolve_file_type: bool
) -> Pin<Box<dyn Future<Output = Result<Metadata, SessionChannelExtError>> + Send + '_>>
fn metadata(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
canonicalize: bool,
resolve_file_type: bool
) -> Pin<Box<dyn Future<Output = Result<Metadata, SessionChannelExtError>> + Send + '_>>
Retrieves metadata about a path on a remote machine
sourcefn read_dir(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
depth: usize,
absolute: bool,
canonicalize: bool,
include_root: bool
) -> Pin<Box<dyn Future<Output = Result<(Vec<DirEntry>, Vec<Failure>), SessionChannelExtError>> + Send + '_>>
fn read_dir(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
depth: usize,
absolute: bool,
canonicalize: bool,
include_root: bool
) -> Pin<Box<dyn Future<Output = Result<(Vec<DirEntry>, Vec<Failure>), SessionChannelExtError>> + Send + '_>>
Reads entries from a directory, returning a tuple of directory entries and failures
sourcefn read_file(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SessionChannelExtError>> + Send + '_>>
fn read_file(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SessionChannelExtError>> + Send + '_>>
Reads a remote file as a collection of bytes
sourcefn read_file_text(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<String, SessionChannelExtError>> + Send + '_>>
fn read_file_text(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<String, SessionChannelExtError>> + Send + '_>>
Returns a remote file as a string
sourcefn remove(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
force: bool
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
fn remove(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
force: bool
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
Removes a remote file or directory, supporting removal of non-empty directories if force is true Read more
sourcefn rename(
&mut self,
tenant: impl Into<String>,
src: impl Into<PathBuf>,
dst: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
fn rename(
&mut self,
tenant: impl Into<String>,
src: impl Into<PathBuf>,
dst: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<(), SessionChannelExtError>> + Send + '_>>
Renames a remote file or directory from src to dst
sourcefn watch(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
recursive: bool,
only: impl Into<ChangeKindSet>,
except: impl Into<ChangeKindSet>
) -> Pin<Box<dyn Future<Output = Result<Watcher, WatchError>> + Send + '_>>
fn watch(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>,
recursive: bool,
only: impl Into<ChangeKindSet>,
except: impl Into<ChangeKindSet>
) -> Pin<Box<dyn Future<Output = Result<Watcher, WatchError>> + Send + '_>>
Watches a remote file or directory
sourcefn unwatch(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<(), UnwatchError>> + Send + '_>>
fn unwatch(
&mut self,
tenant: impl Into<String>,
path: impl Into<PathBuf>
) -> Pin<Box<dyn Future<Output = Result<(), UnwatchError>> + Send + '_>>
Unwatches a remote file or directory
sourcefn spawn(
&mut self,
tenant: impl Into<String>,
cmd: impl Into<String>,
args: Vec<impl Into<String>>,
persist: bool,
pty: Option<PtySize>
) -> Pin<Box<dyn Future<Output = Result<RemoteProcess, RemoteProcessError>> + Send + '_>>
fn spawn(
&mut self,
tenant: impl Into<String>,
cmd: impl Into<String>,
args: Vec<impl Into<String>>,
persist: bool,
pty: Option<PtySize>
) -> Pin<Box<dyn Future<Output = Result<RemoteProcess, RemoteProcessError>> + Send + '_>>
Spawns a process on the remote machine
sourcefn spawn_lsp(
&mut self,
tenant: impl Into<String>,
cmd: impl Into<String>,
args: Vec<impl Into<String>>,
persist: bool,
pty: Option<PtySize>
) -> Pin<Box<dyn Future<Output = Result<RemoteLspProcess, RemoteProcessError>> + Send + '_>>
fn spawn_lsp(
&mut self,
tenant: impl Into<String>,
cmd: impl Into<String>,
args: Vec<impl Into<String>>,
persist: bool,
pty: Option<PtySize>
) -> Pin<Box<dyn Future<Output = Result<RemoteLspProcess, RemoteProcessError>> + Send + '_>>
Spawns an LSP process on the remote machine
sourcefn system_info(
&mut self,
tenant: impl Into<String>
) -> Pin<Box<dyn Future<Output = Result<SystemInfo, SessionChannelExtError>> + Send + '_>>
fn system_info(
&mut self,
tenant: impl Into<String>
) -> Pin<Box<dyn Future<Output = Result<SystemInfo, SessionChannelExtError>> + Send + '_>>
Retrieves information about the remote system
Auto Trait Implementations
impl !RefUnwindSafe for SessionChannel
impl Send for SessionChannel
impl Sync for SessionChannel
impl Unpin for SessionChannel
impl !UnwindSafe for SessionChannel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more