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

Resource's name, ends with '/' if it's a directory.

File size in bytes, None for directories.

Human-readable file size, None for directories.

See util::human_readable_size().

Last modification time in local TZ, None for special "../" entry.

Methods

impl RemoteFile
[src]

Important traits for Vec<u8>
[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]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Ord for RemoteFile
[src]

[src]

This method returns an Ordering between self and other. Read more

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl PartialOrd for RemoteFile
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[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]

[src]

Formats the value using the given formatter. Read more

impl Clone for RemoteFile
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Hash for RemoteFile
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl From<RawFileData> for RemoteFile
[src]

[src]

Performs the conversion.

impl Display for RemoteFile
[src]

Designed for use with TabWriter, separates entries with \ts.

[src]

Formats the value using the given formatter. Read more