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]) -> Bundle
pub fn new(name: &str, bytes: &'static [u8]) -> Bundle
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) -> Bundle
pub fn content_type(self, ct: &str) -> Bundle
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) -> Bundle
pub fn with_alias(self, alias_path: &str) -> Bundle
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).
Auto Trait Implementations§
impl Freeze for Bundle
impl RefUnwindSafe for Bundle
impl Send for Bundle
impl Sync for Bundle
impl Unpin for Bundle
impl UnsafeUnpin for Bundle
impl UnwindSafe for Bundle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more