Struct Sftp

Source
pub struct Sftp { /* private fields */ }

Implementations§

Source§

impl Sftp

Source

pub fn create_dir(&self, filename: &str, mode: mode_t) -> SshResult<()>

Create a directory. mode specifies the permission bits to use on the directory. They will be modified by the effective umask on the server.

Source

pub fn canonicalize(&self, filename: &str) -> SshResult<String>

Canonicalize filename, resolving relative directory references and symlinks.

Source

pub fn chmod(&self, filename: &str, mode: mode_t) -> SshResult<()>

Change the permissions of a file

Source

pub fn chown(&self, filename: &str, owner: uid_t, group: gid_t) -> SshResult<()>

Change the ownership of a file.

Read the payload of a symlink

Source

pub fn set_metadata( &self, filename: &str, metadata: &SetAttributes, ) -> SshResult<()>

Change certain metadata attributes of the named file.

Source

pub fn metadata(&self, filename: &str) -> SshResult<Metadata>

Retrieve metadata for a file, traversing symlinks

Retrieve metadata for a file, without traversing symlinks.

Source

pub fn rename(&self, filename: &str, new_name: &str) -> SshResult<()>

Rename a file from filename to new_name

Source

pub fn remove_file(&self, filename: &str) -> SshResult<()>

Remove a file or an empty directory

Source

pub fn remove_dir(&self, filename: &str) -> SshResult<()>

Remove an empty directory

Create a symlink on the server. target is the filename of the symlink to be created, and dest is the payload of the symlink.

Source

pub fn open( &self, filename: &str, accesstype: OpenFlags, mode: mode_t, ) -> SshResult<SftpFile>

Open a file on the server. accesstype corresponds to the open(2) flags parameter and controls whether the file is opened for read/write and so on. mode specified the permission bits to use when creating a new file; they will be modified by the effective umask on the server side.

Source

pub fn open_dir(&self, filename: &str) -> SshResult<SftpDir>

Open a directory to obtain directory entries

Source

pub fn read_dir(&self, filename: &str) -> SshResult<Vec<Metadata>>

Convenience function that reads all of the directory entries into a Vec. If you need to deal with very large directories, you may wish to directly use open_dir and manually iterate the directory contents.

Trait Implementations§

Source§

impl Drop for Sftp

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Sftp

Auto Trait Implementations§

§

impl Freeze for Sftp

§

impl RefUnwindSafe for Sftp

§

impl !Sync for Sftp

§

impl Unpin for Sftp

§

impl UnwindSafe for Sftp

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.