1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
use super::common::EmbedableFile;
use std::fmt::Debug;
pub struct EmbeddedFile {
name: &'static str,
data: &'static [u8],
data_gzip: Option<&'static [u8]>,
data_br: Option<&'static [u8]>,
hash: &'static str,
etag: &'static str,
last_modified: Option<&'static str>,
last_modified_timestamp: Option<i64>,
mime_type: Option<&'static str>,
}
impl EmbedableFile for EmbeddedFile {
type Data = &'static [u8];
type Meta = &'static str;
fn name(&self) -> Self::Meta {
self.name
}
fn data(&self) -> Self::Data {
self.data
}
fn data_gzip(&self) -> Option<Self::Data> {
self.data_gzip
}
fn data_br(&self) -> Option<Self::Data> {
self.data_br
}
fn last_modified(&self) -> Option<Self::Meta> {
self.last_modified
}
fn last_modified_timestamp(&self) -> Option<i64> {
self.last_modified_timestamp
}
fn hash(&self) -> Self::Meta {
self.hash
}
fn etag(&self) -> Self::Meta {
self.etag
}
fn mime_type(&self) -> Option<Self::Meta> {
self.mime_type
}
}
impl EmbeddedFile {
#[doc(hidden)]
#[allow(clippy::too_many_arguments)]
pub fn __internal_make(
name: &'static str,
data: &'static [u8],
data_gzip: Option<&'static [u8]>,
data_br: Option<&'static [u8]>,
hash: &'static str,
etag: &'static str,
last_modified: Option<&'static str>,
last_modified_timestamp: Option<i64>,
mime_type: Option<&'static str>,
) -> EmbeddedFile {
EmbeddedFile {
name,
data,
data_gzip,
data_br,
hash,
etag,
last_modified,
last_modified_timestamp,
mime_type,
}
}
}
impl Debug for EmbeddedFile {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("EmbeddedFile")
.field("name", &self.name)
.field("hash", &self.hash)
.field("last_modified", &self.last_modified())
.field("mime_type", &self.mime_type)
.finish()
}
}