1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use rocket::http::uri::{error::PathError, fmt::Path, Segments};
use rocket::request::FromSegments;
use std::path::PathBuf;
pub struct PathBufWithDotfiles(PathBuf);
impl FromSegments<'_> for PathBufWithDotfiles {
type Error = PathError;
fn from_segments(segments: Segments<'_, Path>) -> Result<Self, Self::Error> {
segments.to_path_buf(true).map(Self)
}
}
impl PathBufWithDotfiles {
pub fn get(&self) -> PathBuf {
self.0.clone()
}
}