pub fn segment(&self, name: &str) -> Option<&str> {
        let total_route = match self.route_context {
            None => self.route.url.path(),
            Some(ref ctx) => &ctx.total_route,
        };

        let index = total_route
            .trim_start_matches('/')
            .split('/')
            .position(|segment| segment.starts_with(':') && &segment[1..] == name)?;

        self.route.url.path_segments()?.nth(index)
    }
/// Get the named parameter from the path, as defined in your router. The
/// value will be parsed into the type specified by `T` by calling
/// `value.parse::<T>()`. This method returns `None` if the named
/// parameter does not exist in the current path.
Get the named parameter from the path, as defined in your router. The
value will be parsed into the type specified by `T` by calling
`value.parse::()`. This method returns `None` if the named
parameter does not exist in the current path.
Get the named parameter from the path as defined in your router . The value will be parsed into the type specified by ` T ` by calling ` value . parse :: () ` . This method returns ` None ` if the named parameter does not exist in the current path .
pub fn segment(&self, name: &str) -> Option<&str> {
        let total_route = match self.route_context {
            None => self.route.url.path(),
            Some(ref ctx) => &ctx.total_route,
        };
        let index = total_route
            .trim_start_matches('/')
            .split('/')
            .position(|segment| segment.starts_with(':') && &segment[1..] == name)?;
        self.route.url.path_segments()?.nth(index)
    }
pub fn segment ( & self , name : & str ) -> Option < & str > { let total_route = match self . route_context { None => self . route . url . path ( ) , Some ( ref ctx ) => & ctx . total_route , } ; let index = total_route . trim_start_matches ( '/' ) . split ( '/' ) . position ( | segment | segment . starts_with ( ':' ) && & segment [ 1 .. ] == name ) ? ; self . route . url . path_segments ( ) ? . nth ( index ) }
Get the named parameter from the path, as defined in your router.
Get the named parameter from the path as defined in your router .
&self
name
&str
&self
name
&str