pub struct StaticFilesRuntime { /* private fields */ }Expand description
Thread-safe static asset engine with 64-way sharded hot-file caching and security checks.
Implementations§
Source§impl StaticFilesRuntime
Inherent implementation of StaticFilesRuntime.
impl StaticFilesRuntime
Inherent implementation of StaticFilesRuntime.
Sourcepub fn new(config: StaticFilesConfig) -> Result<Self, String>
pub fn new(config: StaticFilesConfig) -> Result<Self, String>
Compiles a StaticFilesRuntime by canonicalizing config.root_dir.
§Arguments
StaticFilesConfig- Static file server configuration.
§Returns
Result<Self, String>- Ready runtime or canonicalization error message.
Sourcepub fn get_config(&self) -> &StaticFilesConfig
pub fn get_config(&self) -> &StaticFilesConfig
Sourcepub fn cached_bytes(&self) -> usize
pub fn cached_bytes(&self) -> usize
Returns current in-memory hot-file cache usage in bytes.
§Returns
usize- Cached bytes across all 64 shards.
Sourcepub async fn serve_context(&self, ctx: &mut Context) -> bool
pub async fn serve_context(&self, ctx: &mut Context) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Forget for StaticFilesRuntime
impl Freeze for StaticFilesRuntimewhere
*const ArcInner<StaticFilesRuntimeInner> is !null: Freeze,
PhantomData<ArcInner<StaticFilesRuntimeInner>>: Freeze,
impl Move for StaticFilesRuntime
impl RefUnwindSafe for StaticFilesRuntimewhere
Atomic<usize>: RefUnwindSafe,
RwLock<HashMap<String, Arc<CachedRouteEntry>, BuildHasherDefault<FxHasher>>>: RefUnwindSafe,
impl Send for StaticFilesRuntime
impl Sync for StaticFilesRuntime
impl Unpin for StaticFilesRuntime
impl UnsafeUnpin for StaticFilesRuntimewhere
*const ArcInner<StaticFilesRuntimeInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<StaticFilesRuntimeInner>>: UnsafeUnpin,
impl UnwindSafe for StaticFilesRuntimewhere
Arc<StaticFilesRuntimeInner>: UnwindSafe,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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