[Rocket] Dynamic multiple segment routes as a RawStr instead of PathBuf


Is it possible in Rocket to treat multiple segment routes as a RawStr instead of a PathBuf? I don’t want any changes done to the dynamic part of the route (e.g. changing the segment separators). I want the dynamic part as is.

fn get_page(path: PathBuf /* Can this be a RawStr instead? */) -> T { ... }

I don’t care about path traversal attacks since this isn’t a path.


What happens if you provide your own impl of FromSegments for your own type (possibly wrapping RawStr internally)?


FromSegments takes an iterator of Segments. In other words by this point the string I want was already transformed and the “segment separators” removed.


Oh I see. Not sure if we have a Rocket expert on this forum - I’m certainly not one :slight_smile:

You might get an answer faster if you ask this directly on Rocket’s github.