[][src]Enum ffsend_api::file::metadata::Metadata

pub enum Metadata {
    V2 {
        name: String,
        iv: String,
        mime: String,
    },
    V3 {
        name: String,
        mime: String,
        size: u64,
        manifest: Manifest,
    },
}

File metadata, which is send to the server.

Variants

V2

Metadata using in Send v2.

Fields of V2

name: String

The file name.

iv: String

The input vector.

mime: String

The file mimetype. TODO: can we use the Mime type here?

V3

Metadata using in Send v3.

Fields of V3

name: String

The file name.

mime: String

The file mimetype. TODO: can we use the Mime type here?

size: u64

The file size.

manifest: Manifest

The share manifest.

Methods

impl Metadata[src]

pub fn from_send2(iv: &[u8], name: String, mime: &Mime) -> Self[src]

Construct metadata from the given properties.

Parameters:

  • iv: initialisation vector
  • name: file name
  • mime: file mimetype

pub fn from_send3(name: String, mime: String, size: u64) -> Self[src]

Construct metadata from the given properties.

Parameters:

  • name: file name
  • mime: file mimetype
  • size: file size

pub fn to_json(&self) -> String[src]

Convert this structure to a JSON string.

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

Get the file name.

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

Get the file MIME type.

pub fn iv(&self) -> Option<[u8; 12]>[src]

Get the input vector if set.

For Firefox Send v3 and above None is returned as no input vector is used.

pub fn size(&self) -> Option<u64>[src]

Get the file size if set (>= Send v3).

pub fn is_archive(&self) -> bool[src]

Check whether this MIME type is recognized as supported archive type. true is returned if it's an archive, false if not.

Trait Implementations

impl Debug for Metadata[src]

impl Serialize for Metadata[src]

impl<'de> Deserialize<'de> for Metadata[src]

Auto Trait Implementations

impl Send for Metadata

impl Sync for Metadata

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

default fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> Same for T

type Output = T

Should always be Self