[][src]Trait ftp_cmd_list_parse::FtpEntryInfo

pub trait FtpEntryInfo {
    pub fn kind(&self) -> FtpEntryKind;
pub fn name(&self) -> &str;
pub fn size(&self) -> usize;
pub fn date_str(&self) -> &str; pub fn new(string: &str) -> Option<Self>
    where
        Self: TryFrom<&'a str>
, { ... } }

All fields that supports both servers: Unix & MSDOS

Required methods

pub fn kind(&self) -> FtpEntryKind[src]

Represents type of the entry: directory, file, symlink or other.

pub fn name(&self) -> &str[src]

Returns name of the entry.

pub fn size(&self) -> usize[src]

Returns size of the entry.

pub fn date_str(&self) -> &str[src]

Returns date of the entry.

Loading content...

Provided methods

pub fn new(string: &str) -> Option<Self> where
    Self: TryFrom<&'a str>, 
[src]

Returns a new FtpEntry by given string if parsing was successful. Also you can create new FtpEntry by use TryFrom trait.

let ftp_response = "drwxr-xr-x  10 root   root    4096 Dec 21  2012 usr";

match FtpEntry::new(ftp_response) {
    Some(ftp_entry) => {
        assert_eq!(ftp_entry.name(), "usr");
        assert_eq!(ftp_entry.size(), 4096);
        assert_eq!(ftp_entry.date_str(), "Dec 21 2012");
    }
    None => println!("ftp_response is not valid ftp-entry!")
}
Loading content...

Implementors

impl FtpEntryInfo for FtpEntryMsdos[src]

impl FtpEntryInfo for FtpEntryUnix[src]

Loading content...