pub struct ServeDirConfig {
pub enabled: bool,
pub static_dir: String,
pub router_path: String,
pub compression_algorithm: Option<String>,
pub chunk_size: Option<ByteConfig>,
pub not_found_file: Option<String>,
pub display: bool,
}Expand description
§Serve Directory Configuration
Configuration for the Serve Directory Layer
This configuration allows you to set up static file serving using the ServeDir tower layer.
Fields§
§enabled: boolBoolean indicator whether the Serve Directory Layer is enabled. Defaults to false.
static_dir: StringThe directory path containing static files to serve. Defaults to “public”.
router_path: StringThe route path where static files will be accessible. Defaults to “/static”.
compression_algorithm: Option<String>The compression algorithm to use for serving files. (e.g., “gzip”, “br”). Defaults to None.
chunk_size: Option<ByteConfig>The chunk size for streaming files (e.g., “64KB”). Defaults to None.
not_found_file: Option<String>The custom 404 file path to serve when a file is not found. Defaults to None.
display: boolWhether to display the configuration details. Defaults to false.
Trait Implementations§
Source§impl Clone for ServeDirConfig
impl Clone for ServeDirConfig
Source§fn clone(&self) -> ServeDirConfig
fn clone(&self) -> ServeDirConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 ServeDirConfig
impl Debug for ServeDirConfig
Source§impl Default for ServeDirConfig
impl Default for ServeDirConfig
Source§impl<'de> Deserialize<'de> for ServeDirConfigwhere
ServeDirConfig: Default,
impl<'de> Deserialize<'de> for ServeDirConfigwhere
ServeDirConfig: Default,
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
Source§impl DisplayConfig for ServeDirConfig
impl DisplayConfig for ServeDirConfig
Auto Trait Implementations§
impl Freeze for ServeDirConfig
impl RefUnwindSafe for ServeDirConfig
impl Send for ServeDirConfig
impl Sync for ServeDirConfig
impl Unpin for ServeDirConfig
impl UnwindSafe for ServeDirConfig
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