extract_endpoint_path_segment_variable

Function extract_endpoint_path_segment_variable 

Source
pub fn extract_endpoint_path_segment_variable(segment: &str) -> Option<&str>
Available on crate feature api only.
Expand description

Extract the variable of the given endpoint path segment.

The supported syntax for an endpoint path segment variable is {var}.

Returns the name of the variable if one was found in the segment, None if no variable was found.

Panics if:

  • The segment begins with { but doesn’t end with }.
  • The segment ends with } but doesn’t begin with {.
  • The segment begins with :, which matches the old syntax for endpoint path segment variables.