pub struct RouterBuilder<T> { /* private fields */ }
Expand description

Builds application with routing.

Implementations§

source§

impl<T> RouterBuilder<T>

source

pub fn add_page<C>(self, path: &'static str) -> RouterBuilder<Valid>
where C: Component + Default + 'static,

Adds provided page to application under provided path in variable path. Page is represented by custom component - struct implementing trait Component and Default.

source

pub fn add_not_found_page<C>(self, path: &'static str) -> RouterBuilder<Valid>
where C: Component + Default + 'static,

Adds provided not found page to application. All routes which cannot be resolved will be redirected to this page. Adding more than one not found page results in undefined behavior.

source§

impl RouterBuilder<Valid>

source

pub fn build(self) -> Router

Builds router. If not found page was not specified, default one is provided under /404 route.

Trait Implementations§

source§

impl Default for RouterBuilder<Invalid>

source§

fn default() -> Self

Creates default RouterBuilder in Invalid state.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for RouterBuilder<T>

§

impl<T> !Send for RouterBuilder<T>

§

impl<T> !Sync for RouterBuilder<T>

§

impl<T> Unpin for RouterBuilder<T>
where T: Unpin,

§

impl<T> !UnwindSafe for RouterBuilder<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.