pub enum Segment {
Slash,
Dot,
Exact(String),
Param(String),
Wildcard,
}Expand description
the internal representation of a parsed component of a route
as an example, /hello/:planet/* would be represented as the
following sequence [Exact("hello"), Slash, Param("planet"), Slash, Wildcard]
Variants§
Slash
represented by a / in the route spec and matching one /
Dot
represented by a . in the route spec and matching one . in the path
Exact(String)
represented by any free text in the route spec, this matches exactly that text
Param(String)
represented by :name, where name is how the capture will be
available in Captures. Param captures up to the next slash
or dot, whichever is next in the spec.
Wildcard
represented by * in the spec, this will capture everything up
to the end of the path. a wildcard will also match nothing
(similar to the regex (.*)$). There can only be one wildcard
per route spec
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for Segment
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for Segment
Available on crate feature
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreimpl Eq for Segment
Source§impl Ord for Segment
impl Ord for Segment
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Segment
impl PartialOrd for Segment
impl StructuralPartialEq for Segment
Auto Trait Implementations§
impl Freeze for Segment
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnsafeUnpin for Segment
impl UnwindSafe for Segment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more