Compare commits

...

3 Commits

Author SHA1 Message Date
Greg Johnston
925c7641db cargo fmt 2023-02-01 14:32:30 -05:00
Greg Johnston
ff2c3c97f5 Make RouteDefinition visible 2023-02-01 14:27:13 -05:00
Greg Johnston
b4d9dc9078 Make RouteDefinition visible 2023-02-01 14:27:00 -05:00
3 changed files with 601 additions and 631 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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))]

View File

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