pub struct EmbeddedFile {
pub url: &'static str,
pub hashed_url: Option<&'static str>,
pub logical_path: &'static str,
pub bytes: &'static [u8],
pub content_type: &'static str,
pub etag: &'static str,
pub hash: &'static str,
}Expand description
A single embedded asset: its content plus the metadata needed to serve it.
Values of this type are generated at build time and stored in a static slice; you do not
construct them by hand.
Every file records its stable, non-hashed url. Files that are content-hashed
(the default) are served at their cache-busted hashed_url; files in an
immutable_dir are not re-hashed, have hashed_url == None, and are served at their plain
url.
Fields§
§url: &'static strThe stable, non-hashed URL mirroring the file’s path under the crate root with a leading
slash, e.g. /assets/css/style.css. This URL is served only for assets in an
immutable_dir; ordinary assets are served only at their hashed_url.
hashed_url: Option<&'static str>The full, content-hashed, cache-busted URL, e.g. /assets/css/style.9f3a1c2b.css, served
immutable. None for assets in an immutable_dir (already immutable, so not re-hashed).
When present, this is what the generated asset! macro and Assets::url prefer.
logical_path: &'static strThe original path of the file relative to the crate root, e.g. assets/css/style.css
— the key you pass to asset! and Assets::get_logical.
bytes: &'static [u8]The raw file contents (via include_bytes!).
content_type: &'static strThe guessed MIME type, e.g. text/css.
etag: &'static strA strong, quoted ETag derived from the content hash, e.g. "\"9f3a1c2b…\"".
hash: &'static strThe hex content hash used for cache busting and the ETag.
Trait Implementations§
Source§impl Clone for EmbeddedFile
impl Clone for EmbeddedFile
Source§fn clone(&self) -> EmbeddedFile
fn clone(&self) -> EmbeddedFile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more