pub fn from(segment: &str) -> PathSegment {
        if segment.starts_with('{') || segment.ends_with('}') {
            assert!(
                segment.starts_with('{'),
                "{}",
                "HTTP URI path segment variable missing leading \"{\""
            );
            assert!(
                segment.ends_with('}'),
                "{}",
                "HTTP URI path segment variable missing trailing \"}\""
            );
            assert!(
                segment.len() > 2,
                "HTTP URI path segment variable name cannot be empty"
            );

            PathSegment::Varname((&segment[1..segment.len() - 1]).to_string())
        } else {
            PathSegment::Literal(segment.to_string())
        }
    }
/**
     * Given a `&str` representing a path segment from a Uri, return a
     * PathSegment.  This is used to parse a sequence of path segments to the
     * corresponding `PathSegment`, which basically means determining whether
     * it's a variable or a literal.
     */
Given a `&str` representing a path segment from a Uri, return a
PathSegment.  This is used to parse a sequence of path segments to the
corresponding `PathSegment`, which basically means determining whether
it's a variable or a literal.
Given a ` &str ` representing a path segment from a Uri return a PathSegment . This is used to parse a sequence of path segments to the corresponding ` PathSegment ` which basically means determining whether it ' s a variable or a literal .
pub fn from(segment: &str) -> PathSegment {
        if segment.starts_with('{') || segment.ends_with('}') {
            assert!(
                segment.starts_with('{'),
                "{}",
                "HTTP URI path segment variable missing leading \"{\""
            );
            assert!(
                segment.ends_with('}'),
                "{}",
                "HTTP URI path segment variable missing trailing \"}\""
            );
            assert!(
                segment.len() > 2,
                "HTTP URI path segment variable name cannot be empty"
            );
            PathSegment::Varname((&segment[1..segment.len() - 1]).to_string())
        } else {
            PathSegment::Literal(segment.to_string())
        }
    }
pub fn from ( segment : & str ) -> PathSegment { if segment . starts_with ( '{' ) || segment . ends_with ( '}' ) { assert ! ( segment starts_with ( '{' ) " " " \" \" " ) ; assert ! ( segment ends_with ( '}' ) " " " \" \" " ) ; assert ! ( segment len ( ) 2 " " ) ; PathSegment :: Varname ( ( & segment [ 1 .. segment . len ( ) - 1 ] ) . to_string ( ) ) } else { PathSegment :: Literal ( segment . to_string ( ) ) } }
Given a `&str` representing a path segment from a Uri, return a
 PathSegment.
Given a ` &str ` representing a path segment from a Uri return a PathSegment .
segment
&str
segment
&str