-
I'm wanting to take an url I have already and replace the PathAndQuery part, or make a new url with a new PathAndQuery. But that seems impossible as making a PathAndQuery requires a static str. So you can't use format!("files/{}", file_name).as_str() to make a PathAndQuery. Basically I gave up and will just build it up as a string, then parse with Uri::try_from(). Am I doing it wrong? It seems like the Uri api is trying to give me an interface for building/remixing uris from Parts, but due to static lifetimes its not quite usable. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
"/path?q=1".parse::<PathAndQuery>().unwrap() |
Beta Was this translation helpful? Give feedback.
PathAndQuery
implementFromStr
so you can use this to create it from a non-'static str.