Skip to main content

FtpConnection

Struct FtpConnection 

Source
pub struct FtpConnection {
    pub stream: BufReader<TcpStream>,
    pub options: FtpOptions,
    pub host: String,
    pub port: u16,
}

Fields§

§stream: BufReader<TcpStream>§options: FtpOptions§host: String§port: u16

Implementations§

Source§

impl FtpConnection

Source

pub async fn connect( host: &str, port: u16, options: Option<FtpOptions>, ) -> Result<Self, String>

Source

pub async fn login(&mut self) -> Result<(), String>

Source

pub async fn cwd(&mut self, path: &str) -> Result<(), String>

Source

pub async fn size(&mut self, filename: &str) -> Result<u64, String>

Source

pub async fn mdtm(&mut self, filename: &str) -> Result<String, String>

Source

pub async fn pasv(&mut self) -> Result<(String, u16), String>

Source

pub async fn epsv(&mut self) -> Result<u16, String>

Source

pub async fn port_active(&mut self) -> Result<u16, String>

Enter active mode using PORT command (IPv4) Binds a local socket and sends PORT command with local address

Source

pub async fn eprt_active(&mut self) -> Result<(String, u16), String>

Enter active mode using EPRT command (IPv6/IPv4) Extended PORT command that supports both IPv4 and IPv6

Source

pub async fn rest(&mut self, offset: u64) -> Result<(), String>

Source

pub async fn retr(&mut self, filename: &str) -> Result<(), String>

Source

pub async fn type_image(&mut self) -> Result<(), String>

Source

pub async fn quit(self) -> Result<(), String>

Source

pub async fn abor(&mut self) -> Result<(), String>

Send ABOR command to abort a transfer in progress

Source

pub async fn list(&mut self, path: Option<&str>) -> Result<FtpResponse, String>

Send LIST command to get directory listing (detailed format)

Source

pub async fn nlst(&mut self, path: Option<&str>) -> Result<FtpResponse, String>

Send NLST command to get directory listing (names only)

Source

pub async fn type_ascii(&mut self) -> Result<(), String>

Send TYPE A command for ASCII mode transfer

Source

pub async fn noop(&mut self) -> Result<(), String>

Send NOOP command for keep-alive / connection test

Source

pub fn start_keepalive(&self) -> Option<JoinHandle<()>>

Start keep-alive task for control channel Returns a handle that can be used to stop the keep-alive

Source

pub fn get_data_stream(&mut self) -> &mut BufReader<TcpStream>

Source

pub async fn read_response(&mut self) -> Result<FtpResponse, String>

Auto Trait Implementations§

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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