pub struct FileState {
pub base: Option<Dirs>,
}Expand description
State extracted by file handlers to access directory configuration.
Use with axum’s FromRef to extract from your application state:
ⓘ
use axum::extract::FromRef;
use stately_files::state::FileState;
#[derive(Clone)]
struct AppState {
dirs: Dirs,
// ... other fields
}
impl FromRef<AppState> for FileState {
fn from_ref(state: &AppState) -> Self {
FileState { base: Some(state.dirs.clone()) }
}
}Fields§
§base: Option<Dirs>Optional directory configuration override.
If None, handlers use the global Dirs::get() defaults.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileState
impl<'de> Deserialize<'de> for FileState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for FileState
Auto Trait Implementations§
impl Freeze for FileState
impl RefUnwindSafe for FileState
impl Send for FileState
impl Sync for FileState
impl Unpin for FileState
impl UnwindSafe for FileState
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