pub struct FtpSession {
pub name: String,
pub host: Option<String>,
pub port: u16,
pub user: Option<String>,
pub pwd: Option<String>,
pub connected: bool,
pub logged_in: bool,
pub transfer_type: TransferType,
pub transfer_mode: TransferMode,
pub passive: bool,
/* private fields */
}Expand description
FTP session state
Fields§
§name: String§host: Option<String>§port: u16§user: Option<String>§pwd: Option<String>§connected: bool§logged_in: bool§transfer_type: TransferType§transfer_mode: TransferMode§passive: boolImplementations§
Source§impl FtpSession
impl FtpSession
pub fn new(name: &str) -> Self
Sourcepub fn connect(&mut self, host: &str, port: Option<u16>) -> Result<FtpResponse>
pub fn connect(&mut self, host: &str, port: Option<u16>) -> Result<FtpResponse>
Connect to FTP server — DNS resolution on background thread to avoid hangs
Sourcepub fn login(&mut self, user: &str, pass: Option<&str>) -> Result<FtpResponse>
pub fn login(&mut self, user: &str, pass: Option<&str>) -> Result<FtpResponse>
Login to FTP server
Sourcepub fn set_type(&mut self, transfer_type: TransferType) -> Result<FtpResponse>
pub fn set_type(&mut self, transfer_type: TransferType) -> Result<FtpResponse>
Set transfer type
Sourcepub fn cd(&mut self, path: &str) -> Result<FtpResponse>
pub fn cd(&mut self, path: &str) -> Result<FtpResponse>
Change directory
Sourcepub fn cdup(&mut self) -> Result<FtpResponse>
pub fn cdup(&mut self) -> Result<FtpResponse>
Change to parent directory
Sourcepub fn list(&mut self, path: Option<&str>) -> Result<(FtpResponse, Vec<String>)>
pub fn list(&mut self, path: Option<&str>) -> Result<(FtpResponse, Vec<String>)>
List directory
Sourcepub fn nlst(&mut self, path: Option<&str>) -> Result<(FtpResponse, Vec<String>)>
pub fn nlst(&mut self, path: Option<&str>) -> Result<(FtpResponse, Vec<String>)>
List filenames only
Sourcepub fn delete(&mut self, path: &str) -> Result<FtpResponse>
pub fn delete(&mut self, path: &str) -> Result<FtpResponse>
Delete a file
Sourcepub fn mkdir(&mut self, path: &str) -> Result<FtpResponse>
pub fn mkdir(&mut self, path: &str) -> Result<FtpResponse>
Make directory
Sourcepub fn rmdir(&mut self, path: &str) -> Result<FtpResponse>
pub fn rmdir(&mut self, path: &str) -> Result<FtpResponse>
Remove directory
Sourcepub fn quote(&mut self, cmd: &str) -> Result<FtpResponse>
pub fn quote(&mut self, cmd: &str) -> Result<FtpResponse>
Send raw command
Sourcepub fn close(&mut self) -> Result<FtpResponse>
pub fn close(&mut self) -> Result<FtpResponse>
Close connection
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FtpSession
impl RefUnwindSafe for FtpSession
impl Send for FtpSession
impl Sync for FtpSession
impl Unpin for FtpSession
impl UnsafeUnpin for FtpSession
impl UnwindSafe for FtpSession
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more