pub struct StaticAssets { /* private fields */ }Expand description
Traversal-safe fallback for a static directory, embedded assets, or both.
Embedded assets take precedence over files in the directory. Explicit Actix routes still take precedence because this handler is installed as the application’s default service.
Implementations§
Source§impl StaticAssets
impl StaticAssets
Sourcepub fn directory(root: impl AsRef<Path>) -> Result<Self, StaticAssetsError>
pub fn directory(root: impl AsRef<Path>) -> Result<Self, StaticAssetsError>
Creates a fallback rooted at an existing directory. The root is canonicalized immediately.
Sourcepub fn embedded<I, P>(assets: I) -> Result<Self, StaticAssetsError>
pub fn embedded<I, P>(assets: I) -> Result<Self, StaticAssetsError>
Creates an embedded-only fallback.
Sourcepub fn with_embedded(
self,
path: impl AsRef<str>,
asset: EmbeddedAsset,
) -> Result<Self, StaticAssetsError>
pub fn with_embedded( self, path: impl AsRef<str>, asset: EmbeddedAsset, ) -> Result<Self, StaticAssetsError>
Adds or overlays an embedded asset.
Sourcepub fn with_index_file(
self,
index_file: impl Into<String>,
) -> Result<Self, StaticAssetsError>
pub fn with_index_file( self, index_file: impl Into<String>, ) -> Result<Self, StaticAssetsError>
Changes the file served for a directory-style request such as / or /docs/.
Trait Implementations§
Source§impl Clone for StaticAssets
impl Clone for StaticAssets
Source§fn clone(&self) -> StaticAssets
fn clone(&self) -> StaticAssets
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 moreSource§impl Debug for StaticAssets
impl Debug for StaticAssets
Auto Trait Implementations§
impl Freeze for StaticAssets
impl RefUnwindSafe for StaticAssets
impl Send for StaticAssets
impl Sync for StaticAssets
impl Unpin for StaticAssets
impl UnsafeUnpin for StaticAssets
impl UnwindSafe for StaticAssets
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request