ft_sdk/from_request/path.rs
1pub struct Path(pub String);
2
3impl ft_sdk::FromRequest for Path {
4 fn from_request(req: &http::Request<serde_json::Value>) -> Result<Self, ft_sdk::Error> {
5 let path = req.uri().path().to_string();
6 Ok(Self(path))
7 }
8}
9
10impl std::fmt::Display for Path {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 f.write_str(&self.0)
13 }
14}
15
16impl AsRef<str> for Path {
17 fn as_ref(&self) -> &str {
18 &self.0
19 }
20}