pub enum RouteSegment {
Static(String),
Dynamic(String),
Regex(String, Regex),
}Expand description
Represents the different types of segments that can make up a route path.
A route path is parsed into a sequence of these segments. For example, the path
/users/:id/posts would be broken down into Static("users"), Dynamic("id"),
and Static("posts").
Variants§
Static(String)
A static, literal segment of a path.
This must be an exact match. For example, in /users/active, “users” and “active”
are both static segments.
Dynamic(String)
A dynamic segment that captures a value from the path. It is denoted by a colon prefix. The captured value is stored as a parameter in the request context.
Regex(String, Regex)
A segment that is matched against a regular expression.
This allows for more complex and flexible routing logic. The first element is the parameter
name, and the second is the compiled Regex object.
Trait Implementations§
Source§impl Clone for RouteSegment
impl Clone for RouteSegment
Source§fn clone(&self) -> RouteSegment
fn clone(&self) -> RouteSegment
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouteSegment
impl Debug for RouteSegment
Source§impl Display for RouteSegment
impl Display for RouteSegment
Source§impl Hash for RouteSegment
Implements the Hash trait for RouteSegment.
impl Hash for RouteSegment
Implements the Hash trait for RouteSegment.
This allows RouteSegment to be used in hash-based collections.
Source§impl Ord for RouteSegment
Implements the Ord trait for RouteSegment.
impl Ord for RouteSegment
Implements the Ord trait for RouteSegment.
This allows for total ordering of RouteSegment instances.
Source§impl PartialEq for RouteSegment
Implements the PartialEq trait for RouteSegment.
impl PartialEq for RouteSegment
Implements the PartialEq trait for RouteSegment.
This allows for comparing two RouteSegment instances for equality.
Source§impl PartialOrd for RouteSegment
Implements the PartialOrd trait for RouteSegment.
impl PartialOrd for RouteSegment
Implements the PartialOrd trait for RouteSegment.
This allows for partial ordering of RouteSegment instances.
impl Eq for RouteSegment
Implements the Eq trait for RouteSegment.
This indicates that RouteSegment has a total equality relation.