pub struct RemoteFile { /* private fields */ }
Expand description

A struct representing an uploaded file on a Send host.

The struct contains the file ID, the file URL, the key that is required in combination with the file, and the owner key.

Implementations

Construct a new file.

Construct a new file, that was created at this exact time. This will set the file expiration time

Try to parse the given share URL.

The given URL is matched against a share URL pattern, this does not check whether the host is a valid and online host.

If the URL fragmet contains a file secret, it is also parsed. If it does not, the secret is left empty and must be specified manually.

An optional owner token may be given.

Get the file ID.

Get the time the file will expire after. Note that this time may not be correct as it may have been guessed, see expire_uncertain().

Get the duration the file will expire after. Note that this time may not be correct as it may have been guessed, see expire_uncertain().

Set the time this file will expire at. None may be given to assign the default expiry time with the uncertainty flag set.

Set the time this file will expire at, based on the given duration from now.

Check whether this file has expired, based on it’s expiry property.

Check whehter the set expiry time is uncertain. If the expiry time of a file is unknown, the default time is assigned from the first time the file was used. Such time will be uncertain as it probably isn’t correct. This time may be used however to check for expiry.

Get the file URL, provided by the server.

Get the raw secret.

Get the secret as base64 encoded string.

Set the secret for this file.

Check whether a file secret is set. This secret must be set to decrypt a downloaded Send file.

Get the owner token if set.

Get the owner token if set.

Set the owner token, wrapped in an option. If None is given, the owner token will be unset.

Check whether an owner token is set in this remote file.

Get the host URL for this remote file.

Build the download URL of the given file. This URL is identical to the share URL, a term used in this API. Set secret to true, to include it in the URL if known.

Merge properties non-existant into this file, from the given other file. This is ofcourse only done for properties that may be empty.

The file IDs are not asserted for equality.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.