Skip to main content

Bundle

Struct Bundle 

Source
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

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.