Struct doh::ops::RemoteFile
[−]
[src]
pub struct RemoteFile { pub full_name: String, pub size: Option<u64>, pub human_size: Option<String>, pub last_modified: Option<Tm>, }
Parsed RawFileData
entry, prepared for end-user usage.
Fields
full_name: String
Resource's name, ends with '/'
if it's a directory.
size: Option<u64>
File size in bytes, None
for directories.
human_size: Option<String>
Human-readable file size, None
for directories.
last_modified: Option<Tm>
Last modification time in local TZ, None
for special "../"
entry.
Methods
impl RemoteFile
[src]
pub fn from_response(resp: FilesetData) -> Vec<RemoteFile>
[src]
Parse a server-returned fileset into a set of user-viewable files.
The returned vector is empty if the specified fileset describes a file.
The returned vector contains an additional entry at the front with name "../"
if the fileset isn't a root directory.
The returned vector is partitioned according depending on directoriness status of the entry, directories first.
Examples
assert_eq!(RemoteFile::from_response(FilesetData { writes_supported: false, is_root: false, is_file: false, files: vec![ RawFileData { mime_type: "text/directory".parse().unwrap(), name: "data".to_string(), last_modified: parse_rfc3339("2012-02-22T14:53:18.42Z").unwrap(), size: 0, is_file: false, }, RawFileData { mime_type: "text/html".parse().unwrap(), name: "index.html".to_string(), last_modified: parse_rfc3339("2012-02-22T15:23:18Z").unwrap(), size: 2297, is_file: true, }, ], }), vec![ RemoteFile { full_name: "../".to_string(), size: None, human_size: None, last_modified: None, }, RemoteFile { full_name: "data/".to_string(), size: None, human_size: None, last_modified: Some(parse_rfc3339("2012-02-22T14:53:18.42Z").unwrap().to_local()), }, RemoteFile { full_name: "index.html".to_string(), size: Some(2297), human_size: Some("2.2KiB".to_string()), last_modified: Some(parse_rfc3339("2012-02-22T15:23:18Z").unwrap().to_local()), }, ]);
Trait Implementations
impl Eq for RemoteFile
[src]
impl PartialEq for RemoteFile
[src]
fn eq(&self, __arg_0: &RemoteFile) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &RemoteFile) -> bool
[src]
This method tests for !=
.
impl Ord for RemoteFile
[src]
fn cmp(&self, __arg_0: &RemoteFile) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl PartialOrd for RemoteFile
[src]
fn partial_cmp(&self, __arg_0: &RemoteFile) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &RemoteFile) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &RemoteFile) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &RemoteFile) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &RemoteFile) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for RemoteFile
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for RemoteFile
[src]
fn clone(&self) -> RemoteFile
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Hash for RemoteFile
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl From<RawFileData> for RemoteFile
[src]
fn from(rfd: RawFileData) -> RemoteFile
[src]
Performs the conversion.
impl Display for RemoteFile
[src]
Designed for use with TabWriter
, separates entries with \t
s.