Skip to main content

DownloadItem

Struct DownloadItem 

Source
#[non_exhaustive]
pub struct DownloadItem {
Show 17 fields pub id: DownloadId, pub url: String, pub filename: String, pub state: DownloadState, pub bytes_received: u64, pub total_bytes: Option<u64>, pub file_size: Option<u64>, pub error: Option<String>, pub start_time: String, pub end_time: Option<String>, pub paused: bool, pub can_resume: bool, pub exists: bool, pub mime: Option<String>, pub incognito: bool, pub estimated_end_time: Option<String>, pub danger: Option<String>,
}
Expand description

Details about a download.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: DownloadId

Browser-assigned download ID.

§url: String

The URL that was downloaded.

§filename: String

Absolute filesystem path where the file was saved.

§state: DownloadState

Current state of the download.

§bytes_received: u64

Bytes received so far.

§total_bytes: Option<u64>

Total file size in bytes, or None if unknown.

§file_size: Option<u64>

Final file size in bytes, or None if unknown.

§error: Option<String>

Error reason if the download was interrupted.

§start_time: String

ISO 8601 timestamp when the download started.

§end_time: Option<String>

ISO 8601 timestamp when the download ended.

§paused: bool

Whether the download is paused.

§can_resume: bool

Whether an interrupted download can be resumed.

§exists: bool

Whether the downloaded file still exists on disk.

§mime: Option<String>

MIME type of the downloaded file.

§incognito: bool

Whether the download is associated with a private/incognito session.

§estimated_end_time: Option<String>

Predicted completion time as an ISO 8601 timestamp string.

§danger: Option<String>

Danger classification of the download (e.g. “safe”, “file”, “url”, “uncommon”, “malware”).

Implementations§

Source§

impl DownloadItem

Source

pub const fn new( id: DownloadId, url: String, filename: String, state: DownloadState, bytes_received: u64, total_bytes: Option<u64>, file_size: Option<u64>, error: Option<String>, start_time: String, end_time: Option<String>, paused: bool, can_resume: bool, exists: bool, mime: Option<String>, incognito: bool, estimated_end_time: Option<String>, danger: Option<String>, ) -> Self

Create a new DownloadItem.

Trait Implementations§

Source§

impl Clone for DownloadItem

Source§

fn clone(&self) -> DownloadItem

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DownloadItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DownloadItem

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for DownloadItem

Source§

fn eq(&self, other: &DownloadItem) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DownloadItem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for DownloadItem

Source§

impl StructuralPartialEq for DownloadItem

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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