Struct remotefs_ftp::client::FtpFs
source · pub struct FtpFs { /* private fields */ }
Expand description
Ftp file system client
Implementations§
source§impl FtpFs
impl FtpFs
sourcepub fn active_mode(self) -> Self
pub fn active_mode(self) -> Self
Set active mode for client
sourcepub fn passive_mode(self) -> Self
pub fn passive_mode(self) -> Self
Set passive mode for client
Trait Implementations§
source§impl RemoteFs for FtpFs
impl RemoteFs for FtpFs
source§fn connect(&mut self) -> RemoteResult<Welcome>
fn connect(&mut self) -> RemoteResult<Welcome>
Connect to the remote server and authenticate.
Can return banner / welcome message on success.
If client has already established connection, then
AlreadyConnected
error is returned.source§fn disconnect(&mut self) -> RemoteResult<()>
fn disconnect(&mut self) -> RemoteResult<()>
Disconnect from the remote server
source§fn is_connected(&mut self) -> bool
fn is_connected(&mut self) -> bool
Gets whether the client is connected to remote
source§fn pwd(&mut self) -> RemoteResult<PathBuf>
fn pwd(&mut self) -> RemoteResult<PathBuf>
Get working directory
source§fn change_dir(&mut self, dir: &Path) -> RemoteResult<PathBuf>
fn change_dir(&mut self, dir: &Path) -> RemoteResult<PathBuf>
Change working directory.
Returns the realpath of new directory
source§fn list_dir(&mut self, path: &Path) -> RemoteResult<Vec<File>>
fn list_dir(&mut self, path: &Path) -> RemoteResult<Vec<File>>
List directory entries at specified
path
source§fn stat(&mut self, path: &Path) -> RemoteResult<File>
fn stat(&mut self, path: &Path) -> RemoteResult<File>
Stat file at specified
path
and return Entrysource§fn setstat(&mut self, _path: &Path, _metadata: Metadata) -> RemoteResult<()>
fn setstat(&mut self, _path: &Path, _metadata: Metadata) -> RemoteResult<()>
Set metadata for file at specifieed
path
source§fn exists(&mut self, path: &Path) -> RemoteResult<bool>
fn exists(&mut self, path: &Path) -> RemoteResult<bool>
Returns whether file at specified
path
exists.source§fn remove_file(&mut self, path: &Path) -> RemoteResult<()>
fn remove_file(&mut self, path: &Path) -> RemoteResult<()>
Remove file at specified
path
.
Fails if is not a file or doesn’t existsource§fn remove_dir(&mut self, path: &Path) -> RemoteResult<()>
fn remove_dir(&mut self, path: &Path) -> RemoteResult<()>
Remove directory at specified
path
Directory is removed only if emptysource§fn create_dir(&mut self, path: &Path, _mode: UnixPex) -> RemoteResult<()>
fn create_dir(&mut self, path: &Path, _mode: UnixPex) -> RemoteResult<()>
Create a directory at
path
with specified mode.source§fn symlink(&mut self, _path: &Path, _target: &Path) -> RemoteResult<()>
fn symlink(&mut self, _path: &Path, _target: &Path) -> RemoteResult<()>
Create a symlink at
path
pointing at target
source§fn mov(&mut self, src: &Path, dest: &Path) -> RemoteResult<()>
fn mov(&mut self, src: &Path, dest: &Path) -> RemoteResult<()>
move file/directory from
src
to dest
source§fn exec(&mut self, _cmd: &str) -> RemoteResult<(u32, String)>
fn exec(&mut self, _cmd: &str) -> RemoteResult<(u32, String)>
Execute a command on remote host if supported by host.
Returns command exit code and output (stdout)
source§fn append(
&mut self,
path: &Path,
_metadata: &Metadata
) -> RemoteResult<WriteStream>
fn append( &mut self, path: &Path, _metadata: &Metadata ) -> RemoteResult<WriteStream>
Open file at
path
for appending data.
If the file doesn’t exist, the file is created. Read moresource§fn create(
&mut self,
path: &Path,
_metadata: &Metadata
) -> RemoteResult<WriteStream>
fn create( &mut self, path: &Path, _metadata: &Metadata ) -> RemoteResult<WriteStream>
Create file at path for write.
If the file already exists, its content will be overwritten Read more
source§fn open(&mut self, path: &Path) -> RemoteResult<ReadStream>
fn open(&mut self, path: &Path) -> RemoteResult<ReadStream>
Open file at specified path for read.
source§fn on_read(&mut self, readable: ReadStream) -> RemoteResult<()>
fn on_read(&mut self, readable: ReadStream) -> RemoteResult<()>
Finalize
open_file
method.
This method must be implemented only if necessary; in case you don’t need it, just return Ok(())
The purpose of this method is to finalize the connection with the peer when reading data.
This mighe be necessary for some protocols.
You must call this method each time you want to finalize the read of the remote file. Read moresource§fn on_written(&mut self, writable: WriteStream) -> RemoteResult<()>
fn on_written(&mut self, writable: WriteStream) -> RemoteResult<()>
Finalize
create_file
and append_file
methods.
This method must be implemented only if necessary; in case you don’t need it, just return Ok(())
The purpose of this method is to finalize the connection with the peer when writing data.
This is necessary for some protocols such as FTP.
You must call this method each time you want to finalize the write of the remote file. Read moresource§fn remove_dir_all(&mut self, path: &Path) -> Result<(), RemoteError>
fn remove_dir_all(&mut self, path: &Path) -> Result<(), RemoteError>
Removes a directory at this path, after removing all its contents. Use carefully! Read more
source§fn append_file(
&mut self,
path: &Path,
metadata: &Metadata,
reader: Box<dyn Read>
) -> Result<u64, RemoteError>
fn append_file( &mut self, path: &Path, metadata: &Metadata, reader: Box<dyn Read> ) -> Result<u64, RemoteError>
Blocking implementation of
append
This method SHOULD be implemented ONLY when streams are not supported by the current file transfer.
The developer using the client should FIRST try with create
followed by on_written
If the function returns error of kind UnsupportedFeature
, then he should call this function.
In case of success, returns the amount of bytes written to the remote file Read moresource§fn create_file(
&mut self,
path: &Path,
metadata: &Metadata,
reader: Box<dyn Read>
) -> Result<u64, RemoteError>
fn create_file( &mut self, path: &Path, metadata: &Metadata, reader: Box<dyn Read> ) -> Result<u64, RemoteError>
Blocking implementation of
create
This method SHOULD be implemented ONLY when streams are not supported by the current file transfer.
The developer using the client should FIRST try with create
followed by on_written
If the function returns error of kind UnsupportedFeature
, then he should call this function.
In case of success, returns the amount of bytes written to the remote file Read moresource§fn open_file(
&mut self,
src: &Path,
dest: Box<dyn Write + Send>
) -> Result<u64, RemoteError>
fn open_file( &mut self, src: &Path, dest: Box<dyn Write + Send> ) -> Result<u64, RemoteError>
Blocking implementation of
open
This method SHOULD be implemented ONLY when streams are not supported by the current file transfer.
(since it would work thanks to the default implementation)
The developer using the client should FIRST try with open
followed by on_sent
If the function returns error of kind UnsupportedFeature
, then he should call this function.
In case of success, returns the amount of bytes written to the local stream Read moresource§fn find(&mut self, search: &str) -> Result<Vec<File>, RemoteError>
fn find(&mut self, search: &str) -> Result<Vec<File>, RemoteError>
Find files from current directory (in all subdirectories) whose name matches the provided search
Search supports wildcards (‘?’, ‘*’)
source§fn iter_search(
&mut self,
dir: &Path,
filter: &WildMatchPattern<'*', '?'>
) -> Result<Vec<File>, RemoteError>
fn iter_search( &mut self, dir: &Path, filter: &WildMatchPattern<'*', '?'> ) -> Result<Vec<File>, RemoteError>
Search recursively in
dir
for file matching the wildcard. Read moreAuto Trait Implementations§
impl Freeze for FtpFs
impl RefUnwindSafe for FtpFs
impl Send for FtpFs
impl Sync for FtpFs
impl Unpin for FtpFs
impl UnwindSafe for FtpFs
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