[−][src]Enum ftp_cmd_list_parse::FtpEntry
Represents parsed string as ftp entry.
Implements Deref
to &dyn FtpEntryInfo
, so you can get access
to general fields that supports both servers: Unix & MSDOS.
Variants
Unix(FtpEntryUnix)
Msdos(FtpEntryMsdos)
Implementations
impl FtpEntry
[src]
pub fn new(string: &str) -> Option<Self>
[src]
Returns a new FtpEntry
by given string if parsing was successful.
Also you can create new FtpEntry
by use TryFrom
or TryInto
traits.
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!") }
pub fn is_unix_type(&self) -> bool
[src]
Returns true if FtpEntry
has UNIX-like entry, otherwise false.
pub fn is_msdos_type(&self) -> bool
[src]
Returns true if FtpEntry
has MSDOS-like entry, otherwise false.
pub fn to_unix_type(self) -> FtpEntryUnix
[src]
Converts FtpEntry
to FtpEntryUnix
.
Its may be useful if you need to get additional infomation
like permissions, group, owner and others.
Panics
Panics if the value is not a Unix-like entry.
If you not sure what kind of FtpEntry
is, use try_to_unix_type
instead.
pub fn to_msdos_type(self) -> FtpEntryMsdos
[src]
Converts FtpEntry
to FtpEntryMsdos
.
Panics
Panics if the value is not a Msdos-like entry.
If you not sure what kind of FtpEntry
is, use try_to_msdos_type
instead.
pub fn try_to_unix_type(self) -> Result<FtpEntryUnix, Self>
[src]
Tries to convert FtpEntry
to FtpEntryUnix
.
If it is impossible, returns FtpEntry
back to caller.
pub fn try_to_msdos_type(self) -> Result<FtpEntryMsdos, Self>
[src]
Tries to convert FtpEntry
to FtpEntryMsdos
.
If it is impossible, returns FtpEntry
back to caller.
Trait Implementations
impl Debug for FtpEntry
[src]
impl Deref for FtpEntry
[src]
type Target = dyn FtpEntryInfo
The resulting type after dereferencing.
pub fn deref(&self) -> &Self::Target
[src]
impl TryFrom<&'_ str> for FtpEntry
[src]
Auto Trait Implementations
impl RefUnwindSafe for FtpEntry
[src]
impl Send for FtpEntry
[src]
impl Sync for FtpEntry
[src]
impl Unpin for FtpEntry
[src]
impl UnwindSafe for FtpEntry
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,