fast_down/
url_info.rs

1use std::sync::Arc;
2use url::Url;
3
4#[derive(Debug)]
5pub struct UrlInfo {
6    pub size: u64,
7    pub name: String,
8    pub supports_range: bool,
9    pub fast_download: bool,
10    pub final_url: Url,
11    pub file_id: FileId,
12}
13
14#[derive(Debug, Clone, PartialEq, Eq)]
15pub struct FileId {
16    pub etag: Option<Arc<str>>,
17    pub last_modified: Option<Arc<str>>,
18}
19
20impl FileId {
21    pub fn new(etag: Option<&str>, last_modified: Option<&str>) -> Self {
22        Self {
23            etag: etag.map(Arc::from),
24            last_modified: last_modified.map(Arc::from),
25        }
26    }
27    pub fn empty() -> Self {
28        Self {
29            etag: None,
30            last_modified: None,
31        }
32    }
33}