domi_server/serve/file/
mod.rs1pub mod safety;
10pub mod static_get;
11
12#[cfg(test)]
13mod tests;
14
15pub use static_get::serve_file;
16
17use std::io;
18
19#[derive(Debug)]
21pub struct ServedFile {
22 pub body: Vec<u8>,
23 pub content_type: ContentType,
24}
25
26#[derive(Debug, Clone, Copy, PartialEq, Eq)]
27pub enum ContentType {
28 Html,
29 Css,
30 Js,
31 Json,
32 Png,
33 Jpeg,
34 Svg,
35 PlainText,
36 OctetStream,
37}
38
39#[derive(Debug)]
40#[non_exhaustive]
41pub enum ServeError {
42 NotFound,
43 NotAFile,
44 Io(io::Error),
45 EscapedRoot,
46}