Struct distant_core::LocalDistantApi
source · [−]pub struct LocalDistantApi { /* private fields */ }
Expand description
Represents an implementation of DistantApi
that works with the local machine
where the server using this api is running. In other words, this is a direct
impementation of the API instead of a proxy to another machine as seen with
implementations on top of SSH and other protocol
Implementations
sourceimpl LocalDistantApi
impl LocalDistantApi
sourcepub fn initialize(config: ServerConfig) -> Result<Self>
pub fn initialize(config: ServerConfig) -> Result<Self>
Initialize the api instance
Trait Implementations
sourceimpl DistantApi for LocalDistantApi
impl DistantApi for LocalDistantApi
sourcefn on_accept<'life0, 'life1, 'async_trait>(
&'life0 self,
local_data: &'life1 mut Self::LocalData
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn on_accept<'life0, 'life1, 'async_trait>(
&'life0 self,
local_data: &'life1 mut Self::LocalData
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Injects the global channels into the local connection
type LocalData = ConnectionState
sourcefn config(&self) -> ServerConfig
fn config(&self) -> ServerConfig
Returns config associated with API server
sourcefn capabilities<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>
) -> Pin<Box<dyn Future<Output = Result<Capabilities>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn capabilities<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>
) -> Pin<Box<dyn Future<Output = Result<Capabilities>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Retrieves information about the server’s capabilities. Read more
sourcefn read_file<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read_file<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Reads bytes from a file. Read more
sourcefn read_file_text<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read_file_text<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Reads bytes from a file as text. Read more
sourcefn write_file<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
data: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn write_file<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
data: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Writes bytes to a file, overwriting the file if it exists. Read more
sourcefn write_file_text<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
data: String
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn write_file_text<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
data: String
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Writes text to a file, overwriting the file if it exists. Read more
sourcefn append_file<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
data: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn append_file<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
data: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Writes bytes to the end of a file, creating it if it is missing. Read more
sourcefn append_file_text<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
data: String
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn append_file_text<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
data: String
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Writes bytes to the end of a file, creating it if it is missing. Read more
sourcefn read_dir<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
depth: usize,
absolute: bool,
canonicalize: bool,
include_root: bool
) -> Pin<Box<dyn Future<Output = Result<(Vec<DirEntry>, Vec<Error>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read_dir<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
depth: usize,
absolute: bool,
canonicalize: bool,
include_root: bool
) -> Pin<Box<dyn Future<Output = Result<(Vec<DirEntry>, Vec<Error>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Reads entries from a directory. Read more
sourcefn create_dir<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
all: bool
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn create_dir<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
all: bool
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Creates a directory. Read more
sourcefn remove<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
force: bool
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn remove<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
force: bool
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Removes some file or directory. Read more
sourcefn copy<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
src: PathBuf,
dst: PathBuf
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn copy<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
src: PathBuf,
dst: PathBuf
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Copies some file or directory. Read more
sourcefn rename<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
src: PathBuf,
dst: PathBuf
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn rename<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
src: PathBuf,
dst: PathBuf
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Renames some file or directory. Read more
sourcefn watch<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
recursive: bool,
only: Vec<ChangeKind>,
except: Vec<ChangeKind>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn watch<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
recursive: bool,
only: Vec<ChangeKind>,
except: Vec<ChangeKind>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Watches a file or directory for changes. Read more
sourcefn unwatch<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn unwatch<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Removes a file or directory from being watched. Read more
sourcefn exists<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn exists<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Checks if the specified path exists. Read more
sourcefn metadata<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
canonicalize: bool,
resolve_file_type: bool
) -> Pin<Box<dyn Future<Output = Result<Metadata>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn metadata<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
path: PathBuf,
canonicalize: bool,
resolve_file_type: bool
) -> Pin<Box<dyn Future<Output = Result<Metadata>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Reads metadata for a file or directory. Read more
sourcefn search<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
query: SearchQuery
) -> Pin<Box<dyn Future<Output = Result<SearchId>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
query: SearchQuery
) -> Pin<Box<dyn Future<Output = Result<SearchId>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Searches files for matches based on a query. Read more
sourcefn cancel_search<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
id: SearchId
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn cancel_search<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
id: SearchId
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Cancels an actively-ongoing search. Read more
sourcefn proc_spawn<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
cmd: String,
environment: Environment,
current_dir: Option<PathBuf>,
persist: bool,
pty: Option<PtySize>
) -> Pin<Box<dyn Future<Output = Result<ProcessId>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn proc_spawn<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
cmd: String,
environment: Environment,
current_dir: Option<PathBuf>,
persist: bool,
pty: Option<PtySize>
) -> Pin<Box<dyn Future<Output = Result<ProcessId>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Spawns a new process, returning its id. Read more
sourcefn proc_kill<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
id: ProcessId
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn proc_kill<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
id: ProcessId
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Kills a running process by its id. Read more
sourcefn proc_stdin<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
id: ProcessId,
data: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn proc_stdin<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
id: ProcessId,
data: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Sends data to the stdin of the process with the specified id. Read more
sourcefn proc_resize_pty<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
id: ProcessId,
size: PtySize
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn proc_resize_pty<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>,
id: ProcessId,
size: PtySize
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Resizes the PTY of the process with the specified id. Read more
sourcefn system_info<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>
) -> Pin<Box<dyn Future<Output = Result<SystemInfo>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn system_info<'life0, 'async_trait>(
&'life0 self,
ctx: DistantCtx<Self::LocalData>
) -> Pin<Box<dyn Future<Output = Result<SystemInfo>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Retrieves information about the system. Read more
Auto Trait Implementations
impl !RefUnwindSafe for LocalDistantApi
impl Send for LocalDistantApi
impl Sync for LocalDistantApi
impl Unpin for LocalDistantApi
impl !UnwindSafe for LocalDistantApi
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> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more