Trait Routable

Source
pub trait Routable:
    FromStr<Err: Display>
    + Display
    + Clone
    + 'static {
    const SITE_MAP: &'static [SiteMapSegment];

    // Required method
    fn render(&self, level: usize) -> Element;

    // Provided methods
    fn is_child_of(&self, other: &Self) -> bool { ... }
    fn parent(&self) -> Option<Self> { ... }
    fn flatten_site_map<'a>(    ) -> FlatMap<Iter<'a, SiteMapSegment>, Vec<Vec<SegmentType>>, fn(&SiteMapSegment) -> Vec<Vec<SegmentType>>>  { ... }
    fn static_routes() -> Vec<Self> { ... }
}

Required Associated Constants§

Source

const SITE_MAP: &'static [SiteMapSegment]

The error that can occur when parsing a route.

Required Methods§

Source

fn render(&self, level: usize) -> Element

Render the route at the given level

Provided Methods§

Source

fn is_child_of(&self, other: &Self) -> bool

Checks if this route is a child of the given route.

Source

fn parent(&self) -> Option<Self>

Get the parent route of this route.

Source

fn flatten_site_map<'a>() -> FlatMap<Iter<'a, SiteMapSegment>, Vec<Vec<SegmentType>>, fn(&SiteMapSegment) -> Vec<Vec<SegmentType>>>

Returns a flattened version of Self::SITE_MAP.

Source

fn static_routes() -> Vec<Self>

Gets a list of all the static routes. Example static route: #[route("/static/route")]

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§