pub enum Assets {
Embedded,
Dir(PathBuf),
}Expand description
Where the page assets come from.
Variants§
Embedded
Baked into the binary at compile time: the production path.
Dir(PathBuf)
Read from a directory on each request: the hot-reloading development path.
Implementations§
Source§impl Assets
impl Assets
Sourcepub fn get(&self, path: &str) -> Option<(&'static str, Vec<u8>)>
pub fn get(&self, path: &str) -> Option<(&'static str, Vec<u8>)>
Resolves a request path to a file’s MIME type and bytes.
The request path "/" resolves to the page shell. In Assets::Dir mode any
file under the directory is served (typed by extension), read fresh from disk so
edits show up on reload; a path that escapes the directory resolves to None.
§Arguments
path- the request path, such as"/app/app.js".
§Returns
The MIME type and the file’s bytes, or None if no asset matches.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Assets
impl RefUnwindSafe for Assets
impl Send for Assets
impl Sync for Assets
impl Unpin for Assets
impl UnsafeUnpin for Assets
impl UnwindSafe for Assets
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
Mutably borrows from an owned value. Read more