pub trait FtpEntryInfo {
// Required methods
fn kind(&self) -> FtpEntryKind;
fn name(&self) -> &str;
fn size(&self) -> usize;
fn date_str(&self) -> &str;
// Provided method
fn new(string: &str) -> Option<Self>
where for<'a> Self: TryFrom<&'a str> { ... }
}
Expand description
All fields that supports both servers: Unix & MSDOS
Required Methods§
Sourcefn kind(&self) -> FtpEntryKind
fn kind(&self) -> FtpEntryKind
Represents type of the entry: directory, file, symlink or other.
Provided Methods§
Sourcefn new(string: &str) -> Option<Self>
fn new(string: &str) -> Option<Self>
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!")
}