mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
Make RouteDefinition
public (#430)
This commit is contained in:
parent
63a7a4dec1
commit
b0762bbfb5
2 changed files with 8 additions and 0 deletions
|
@ -202,6 +202,7 @@ mod history;
|
|||
mod hooks;
|
||||
#[doc(hidden)]
|
||||
pub mod matching;
|
||||
pub use matching::RouteDefinition;
|
||||
|
||||
pub use components::*;
|
||||
#[cfg(any(feature = "ssr", doc))]
|
||||
|
|
|
@ -3,11 +3,18 @@ use std::rc::Rc;
|
|||
use leptos::leptos_dom::View;
|
||||
use leptos::*;
|
||||
|
||||
/// Defines a single route in a nested route tree. This is the return
|
||||
/// type of the [`<Route/>`](crate::Route) component, but can also be
|
||||
/// used to build your own configuration-based or filesystem-based routing.
|
||||
#[derive(Clone)]
|
||||
pub struct RouteDefinition {
|
||||
/// A unique ID for each route.
|
||||
pub id: usize,
|
||||
/// The path. This can include params like `:id` or wildcards like `*all`.
|
||||
pub path: String,
|
||||
/// Other route definitions nested within this one.
|
||||
pub children: Vec<RouteDefinition>,
|
||||
/// The view that should be displayed when this route is matched.
|
||||
pub view: Rc<dyn Fn(Scope) -> View>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue