Trait Route

Source
pub trait Route: Sized + Default {
    // Required method
    fn match_route(&self, segments: &[&str]) -> Self;

    // Provided method
    fn match_path(&self, path: &str) -> Self { ... }
}
Expand description

Trait that is implemented for enums that can match routes.

This trait should not be implemented manually. Use the Route derive macro instead.

Required Methods§

Source

fn match_route(&self, segments: &[&str]) -> Self

Matches a route with the given path segments. Note that in general, empty segments should be filtered out before passed as an argument.

It is likely that you are looking for the Route::match_path method instead.

Provided Methods§

Source

fn match_path(&self, path: &str) -> Self

Matches a route with the given path.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§