Skip to main content

NestedRouteConfig

Struct NestedRouteConfig 

Source
pub struct NestedRouteConfig {
    pub path: String,
    pub component: Rc<dyn Fn() -> VirtualNode>,
    pub children: Vec<NestedRouteConfig>,
}
Expand description

A nested route configuration entry.

Routes form a tree: each route can have its own component (the “layout” or “page”) and zero or more child routes. The path of a child route is resolved against the parent path during matching.

Fields§

§path: String

The route path (e.g. /settings/profile).

§component: Rc<dyn Fn() -> VirtualNode>

The component to render for this route.

§children: Vec<NestedRouteConfig>

The child routes, if any.

Implementations§

Source§

impl NestedRouteConfig

Inherent implementation of NestedRouteConfig.

Source

pub fn new<P, F>( path: P, component: F, children: Vec<NestedRouteConfig>, ) -> Self
where P: Into<String>, F: Fn() -> VirtualNode + 'static,

Creates a new nested route configuration.

§Arguments
  • impl Into<String> - The route path.
  • F: Fn() -> VirtualNode + 'static - The component closure.
  • Vec<NestedRouteConfig> - The child routes.
Source

pub fn component(&self) -> Rc<dyn Fn() -> VirtualNode>

Returns the component closure.

§Returns
  • Rc<dyn Fn() -> VirtualNode> - A shared closure producing the route’s component node.
Source

pub fn children(&self) -> &[NestedRouteConfig]

Returns the child routes.

§Returns
  • [NestedRouteConfig] - Slice of all child route configs.
Source§

impl NestedRouteConfig

Source

pub fn get_path(&self) -> &String

Source

pub fn get_mut_path(&mut self) -> &mut String

Source

pub fn set_path(&mut self, val: String) -> &mut Self

Source

pub fn get_component(&self) -> &Rc<dyn Fn() -> VirtualNode>

Source

pub fn get_mut_component(&mut self) -> &mut Rc<dyn Fn() -> VirtualNode>

Source

pub fn set_component(&mut self, val: Rc<dyn Fn() -> VirtualNode>) -> &mut Self

Source

pub fn get_children(&self) -> &Vec<NestedRouteConfig>

Source

pub fn get_mut_children(&mut self) -> &mut Vec<NestedRouteConfig>

Source

pub fn set_children(&mut self, val: Vec<NestedRouteConfig>) -> &mut Self

Trait Implementations§

Source§

impl Clone for NestedRouteConfig

Source§

fn clone(&self) -> NestedRouteConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NestedRouteConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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>,

Source§

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more