Skip to main content

FromPathParam

Trait FromPathParam 

Source
pub trait FromPathParam: Sized {
    // Required method
    fn from_path_param(name: &str, value: &str) -> Result<Self>;
}
Expand description

Parses a single captured URL segment into a typed path parameter.

A blanket implementation covers every type that implements FromStr, so i64, String, Uuid, and similar types work out of the box.

Required Methods§

Source

fn from_path_param(name: &str, value: &str) -> Result<Self>

Parses value, the raw URL segment captured for the parameter name.

name is used only for diagnostics; the raw value is never echoed back in error messages.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> FromPathParam for T
where T: FromStr, T::Err: Display,