static-file-resolver 10.3.0

A library that resolves the file a request asks for under a root directory. It refuses a path that climbs out of the root, so a request cannot reach a file the root does not hold.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::*;

/// The rules that decide which file a request is answered with.
///
/// The resolver holds no server state, so the same rules can be used by any
/// server that serves the files of a directory.
#[derive(Clone, Copy, Debug, Getter)]
pub struct StaticFileResolver<'a> {
    /// The directory the files are served from.
    #[get(type(copy))]
    pub root: &'a Path,
    /// The file that answers a request for a directory.
    #[get(type(copy))]
    pub index: &'a str,
}