pub struct Bundle { /* private fields */ }Expand description
In-memory immutable byte blob registered at boot.
See the crate-level docs for the builder chain and ordering.
Implementations§
Source§impl Bundle
impl Bundle
Sourcepub fn new(name: &str, bytes: &'static [u8]) -> Self
pub fn new(name: &str, bytes: &'static [u8]) -> Self
Register a new bundle. Hashes the bytes (SHA-256), inserts an entry into the
process-global registry keyed by the hashed URL, and returns a Bundle handle.
§Panics
Panics if a bundle with the same name is already registered (D-06). Duplicate
registration is developer error caught at boot.
Sourcepub fn content_type(self, ct: &str) -> Self
pub fn content_type(self, ct: &str) -> Self
Set the content-type. Re-keys the bundle’s hashed URL (appends the extension
derived from the content-type). Call BEFORE .with_alias(...) so aliases
capture the final hashed URL.
Sourcepub fn with_alias(self, alias_path: &str) -> Self
pub fn with_alias(self, alias_path: &str) -> Self
Register a stable plain URL that 301-redirects to the current hashed URL. Multiple aliases per bundle are allowed; each call adds one entry.
Sourcepub fn hashed_url(&self) -> String
pub fn hashed_url(&self) -> String
Return the current hashed URL (/bundles/{name}.{sha8}.{ext} or
/bundles/{name}.{sha8} if the content-type has no known extension).