pub struct Client { /* private fields */ }Expand description
Unified client over SMB / FTP / SFTP.
Holds a type-erased backend (Box<dyn RemoteFileSystem>), so trait methods
forward in one line — no per-protocol match boilerplate.
Backends are gated by Cargo features: smb, ftp, sftp.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn connect_with(config: &Config) -> Result<Self>
pub async fn connect_with(config: &Config) -> Result<Self>
Create a client from a generic config and connect.
Sourcepub fn as_fs(&self) -> &dyn RemoteFileSystem
pub fn as_fs(&self) -> &dyn RemoteFileSystem
Borrow the underlying filesystem trait object.
Sourcepub fn as_fs_mut(&mut self) -> &mut dyn RemoteFileSystem
pub fn as_fs_mut(&mut self) -> &mut dyn RemoteFileSystem
Mutably borrow the underlying filesystem trait object.
Trait Implementations§
Source§impl RemoteFileSystem for Client
impl RemoteFileSystem for Client
Source§fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to the remote server.
Source§fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnect from the remote server.
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Whether the client is currently connected.
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List entries under
path.Source§fn metadata<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FileMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn metadata<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FileMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get metadata for
path.Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check whether
path exists.Source§fn mkdir<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mkdir<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a directory at
path.Source§fn mkdir_all<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mkdir_all<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create directories recursively.
Source§fn rmdir<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn rmdir<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove an empty directory.
Source§fn remove_file<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_file<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a file.
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a file or directory recursively.
Source§fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
from: &'life1 str,
to: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
from: &'life1 str,
to: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Rename / move a path.
Source§fn read<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read entire file into memory.
Source§fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
path: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write entire file from memory.
Source§fn download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
remote: &'life1 str,
local: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
remote: &'life1 str,
local: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Download remote file to local path.
Source§fn upload<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
local: &'life1 Path,
remote: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn upload<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
local: &'life1 Path,
remote: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Upload local file to remote path.
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !Sync for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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