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: StringThe 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.
impl NestedRouteConfig
Inherent implementation of NestedRouteConfig.
Sourcepub fn new<P, F>(
path: P,
component: F,
children: Vec<NestedRouteConfig>,
) -> Self
pub fn new<P, F>( path: P, component: F, children: Vec<NestedRouteConfig>, ) -> Self
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.
Sourcepub fn component(&self) -> Rc<dyn Fn() -> VirtualNode>
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.
Sourcepub fn children(&self) -> &[NestedRouteConfig]
pub fn children(&self) -> &[NestedRouteConfig]
Source§impl NestedRouteConfig
impl NestedRouteConfig
pub fn get_path(&self) -> &String
pub fn get_mut_path(&mut self) -> &mut String
pub fn set_path(&mut self, val: String) -> &mut Self
pub fn get_component(&self) -> &Rc<dyn Fn() -> VirtualNode>
pub fn get_mut_component(&mut self) -> &mut Rc<dyn Fn() -> VirtualNode>
pub fn set_component(&mut self, val: Rc<dyn Fn() -> VirtualNode>) -> &mut Self
pub fn get_children(&self) -> &Vec<NestedRouteConfig>
pub fn get_mut_children(&mut self) -> &mut Vec<NestedRouteConfig>
pub fn set_children(&mut self, val: Vec<NestedRouteConfig>) -> &mut Self
Trait Implementations§
Source§impl Clone for NestedRouteConfig
impl Clone for NestedRouteConfig
Source§fn clone(&self) -> NestedRouteConfig
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for NestedRouteConfig
impl !Send for NestedRouteConfig
impl !Sync for NestedRouteConfig
impl !UnwindSafe for NestedRouteConfig
impl Freeze for NestedRouteConfig
impl Unpin for NestedRouteConfig
impl UnsafeUnpin for NestedRouteConfig
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