pub struct StaticAsset {
pub bytes: &'static [u8],
pub mime: MimeType,
pub ttl: Option<TimeDelta>,
}Expand description
A static blob of bytes
Fields§
§bytes: &'static [u8]The data to return
mime: MimeTypeThe type of bytes
ttl: Option<TimeDelta>How long to cache this response. If None, never cache
Implementations§
Source§impl StaticAsset
impl StaticAsset
Sourcepub const DEFAULT_TTL: Option<TimeDelta>
pub const DEFAULT_TTL: Option<TimeDelta>
Default ttl of a StaticAsset
Trait Implementations§
Source§impl Servable for StaticAsset
Available on non-crate feature image only.
impl Servable for StaticAsset
Available on non-crate feature
image only.Source§fn head<'a>(
&'a self,
_ctx: &'a RenderContext,
) -> Pin<Box<dyn Future<Output = Rendered<()>> + Send + Sync + 'a>>
fn head<'a>( &'a self, _ctx: &'a RenderContext, ) -> Pin<Box<dyn Future<Output = Rendered<()>> + Send + Sync + 'a>>
Return the same response as Servable::render, but with an empty body. Read more
Source§fn render<'a>(
&'a self,
ctx: &'a RenderContext,
) -> Pin<Box<dyn Future<Output = Rendered<RenderedBody>> + Send + Sync + 'a>>
fn render<'a>( &'a self, ctx: &'a RenderContext, ) -> Pin<Box<dyn Future<Output = Rendered<RenderedBody>> + Send + Sync + 'a>>
Render this page. Must return the same metadata as Servable::head.
Consider using crate::Rendered::with_body and Servable::head to implement this fn. Read more
Auto Trait Implementations§
impl Freeze for StaticAsset
impl RefUnwindSafe for StaticAsset
impl Send for StaticAsset
impl Sync for StaticAsset
impl Unpin for StaticAsset
impl UnwindSafe for StaticAsset
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