pub struct ServeEmbedded { /* private fields */ }Expand description
A tower::Service that serves a set of Assets.
Construct one with Assets::service. Each embedded file is served at its full generated URL
(mirroring the file’s location under your crate root): a cache-busted path for ordinary assets,
or the stable, non-hashed path for immutable_dir assets. Mount it as a fallback rather than
nesting it under a prefix:
ⓘ
Router::new().fallback_service(ASSETS.service())It handles GET/HEAD (other methods get 405), conditional requests via If-None-Match
(304 Not Modified), and sets Content-Type and a strong ETag. Generated routes get a
one-year immutable Cache-Control. It is intentionally lean: no precompression, directory
index, or SPA fallback — compose those with other tower layers if you need them.
Trait Implementations§
Source§impl Clone for ServeEmbedded
impl Clone for ServeEmbedded
Source§fn clone(&self) -> ServeEmbedded
fn clone(&self) -> ServeEmbedded
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ServeEmbedded
Source§impl Debug for ServeEmbedded
impl Debug for ServeEmbedded
Source§impl<B> Service<Request<B>> for ServeEmbedded
impl<B> Service<Request<B>> for ServeEmbedded
Source§type Error = Infallible
type Error = Infallible
Errors produced by the service.
Source§type Future = Ready<Result<<ServeEmbedded as Service<Request<B>>>::Response, <ServeEmbedded as Service<Request<B>>>::Error>>
type Future = Ready<Result<<ServeEmbedded as Service<Request<B>>>::Response, <ServeEmbedded as Service<Request<B>>>::Error>>
The future response value.
Auto Trait Implementations§
impl Freeze for ServeEmbedded
impl RefUnwindSafe for ServeEmbedded
impl Send for ServeEmbedded
impl Sync for ServeEmbedded
impl Unpin for ServeEmbedded
impl UnsafeUnpin for ServeEmbedded
impl UnwindSafe for ServeEmbedded
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