Trait rocket::request::FromSegments
[−]
[src]
pub trait FromSegments<'a>: Sized {
type Error: Debug;
fn from_segments(segments: Segments<'a>) -> Result<Self, Self::Error>;
}Trait to convert many dynamic path segment strings to a concrete value.
This is the .. analog to FromParam, and its
functionality is identical to it with one exception: this trait applies to
segment parameters of the form <param..>, where param is of some type
T that implements FromSegments. T::from_segments is called to convert
the matched segments (via the
Segments iterator) into the
implementing type.
Provided Implementations
Rocket implements FromParam for PathBuf. The PathBuf implementation
constructs a path from the segments iterator. Each segment is
percent-decoded. If a segment equals ".." before or after decoding, the
previous segment (if any) is omitted. For security purposes, any other
segments that begin with "*" or "." are ignored. If a percent-decoded
segment results in invalid UTF8, an Err is returned with the Utf8Error.
Associated Types
Required Methods
fn from_segments(segments: Segments<'a>) -> Result<Self, Self::Error>
Parses an instance of Self from many dynamic path parameter strings or
returns an Error if one cannot be parsed.
Implementors
impl<'a> FromSegments<'a> for Segments<'a>impl<'a> FromSegments<'a> for PathBufimpl<'a, T: FromSegments<'a>> FromSegments<'a> for Result<T, T::Error>impl<'a, T: FromSegments<'a>> FromSegments<'a> for Option<T>