Struct Sftp

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

Represents an open sftp channel for performing filesystem operations

Implementations§

Source§

impl Sftp

Source

pub async fn open_with_mode<T, E>( &self, filename: T, opts: OpenOptions, ) -> SftpChannelResult<File>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Open a handle to a file.

Source

pub async fn open<T, E>(&self, filename: T) -> SftpChannelResult<File>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Helper to open a file in the Read mode.

Source

pub async fn create<T, E>(&self, filename: T) -> SftpChannelResult<File>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Helper to create a file in write-only mode with truncation.

Source

pub async fn open_dir<T, E>(&self, filename: T) -> SftpChannelResult<Dir>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Helper to open a directory for reading its contents.

Source

pub async fn read_dir<T, E>( &self, filename: T, ) -> SftpChannelResult<Vec<(Utf8PathBuf, Metadata)>>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Convenience function to read the files in a directory.

The returned paths are all joined with dirname when returned, and the paths . and .. are filtered out of the returned list.

Source

pub async fn create_dir<T, E>( &self, filename: T, mode: i32, ) -> SftpChannelResult<()>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Create a directory on the remote filesystem.

Source

pub async fn remove_dir<T, E>(&self, filename: T) -> SftpChannelResult<()>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Remove a directory from the remote filesystem.

Source

pub async fn metadata<T, E>(&self, filename: T) -> SftpChannelResult<Metadata>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Get the metadata for a file, performed by stat(2).

Get the metadata for a file, performed by lstat(2).

Source

pub async fn set_metadata<T, E>( &self, filename: T, metadata: Metadata, ) -> SftpChannelResult<()>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Set the metadata for a file.

Create symlink at target pointing at path.

Read a symlink at path.

Source

pub async fn canonicalize<T, E>( &self, path: T, ) -> SftpChannelResult<Utf8PathBuf>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Resolve the real path for path.

Source

pub async fn rename<T1, T2, E1, E2>( &self, src: T1, dst: T2, opts: RenameOptions, ) -> SftpChannelResult<()>
where T1: TryInto<Utf8PathBuf, Error = E1>, T2: TryInto<Utf8PathBuf, Error = E2>, E1: Into<Box<dyn Error + Send + Sync>>, E2: Into<Box<dyn Error + Send + Sync>>,

Rename the filesystem object on the remote filesystem.

Source

pub async fn remove_file<T, E>(&self, file: T) -> SftpChannelResult<()>
where T: TryInto<Utf8PathBuf, Error = E>, E: Into<Box<dyn Error + Send + Sync>>,

Remove a file on the remote filesystem.

Trait Implementations§

Source§

impl Clone for Sftp

Source§

fn clone(&self) -> Sftp

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Sftp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Sftp

§

impl RefUnwindSafe for Sftp

§

impl Send 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more