Struct remotefs_ftp::client::FtpFs

source ·
pub struct FtpFs { /* private fields */ }
Expand description

Ftp file system client

Implementations§

source§

impl FtpFs

source

pub fn new<S: AsRef<str>>(hostname: S, port: u16) -> Self

Instantiates a new FtpFs

source

pub fn username<S: AsRef<str>>(self, username: S) -> Self

Set username

source

pub fn password<S: AsRef<str>>(self, password: S) -> Self

Set password

source

pub fn active_mode(self) -> Self

Set active mode for client

source

pub fn passive_mode(self) -> Self

Set passive mode for client

source

pub fn stream(&mut self) -> Option<&mut FtpStream>

Get reference to inner stream

Trait Implementations§

source§

impl RemoteFs for FtpFs

source§

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<()>

Disconnect from the remote server
source§

fn is_connected(&mut self) -> bool

Gets whether the client is connected to remote
source§

fn pwd(&mut self) -> RemoteResult<PathBuf>

Get working directory
source§

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>>

List directory entries at specified path
source§

fn stat(&mut self, path: &Path) -> RemoteResult<File>

Stat file at specified path and return Entry
source§

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>

Returns whether file at specified path exists.
source§

fn remove_file(&mut self, path: &Path) -> RemoteResult<()>

Remove file at specified path. Fails if is not a file or doesn’t exist
source§

fn remove_dir(&mut self, path: &Path) -> RemoteResult<()>

Remove directory at specified path Directory is removed only if empty
source§

fn create_dir(&mut self, path: &Path, _mode: UnixPex) -> RemoteResult<()>

Create a directory at path with specified mode.
Create a symlink at path pointing at target
source§

fn copy(&mut self, _src: &Path, _dest: &Path) -> RemoteResult<()>

Copy src to dest
source§

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)>

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>

Open file at path for appending data. If the file doesn’t exist, the file is created. Read more
source§

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>

Open file at specified path for read.
source§

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 more
source§

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 more
source§

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 + 'static, Global> ) -> 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 more
source§

fn create_file( &mut self, path: &Path, metadata: &Metadata, reader: Box<dyn Read + 'static, Global> ) -> 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 more
source§

fn open_file( &mut self, src: &Path, dest: Box<dyn Write + Send + 'static, Global> ) -> 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 more
source§

fn find(&mut self, search: &str) -> Result<Vec<File, Global>, RemoteError>

Find files from current directory (in all subdirectories) whose name matches the provided search Search supports wildcards (‘?’, ‘*’)
Search recursively in dir for file matching the wildcard. Read more

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.