mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
docs: leptos_router_macro::path
(#2841)
This commit is contained in:
parent
cfe2341dec
commit
621f112f4c
2 changed files with 20 additions and 0 deletions
|
@ -19,6 +19,7 @@ mod ssr_mode;
|
||||||
mod static_route;
|
mod static_route;
|
||||||
|
|
||||||
pub use generate_route_list::*;
|
pub use generate_route_list::*;
|
||||||
|
#[doc(inline)]
|
||||||
pub use leptos_router_macro::path;
|
pub use leptos_router_macro::path;
|
||||||
pub use matching::*;
|
pub use matching::*;
|
||||||
pub use method::*;
|
pub use method::*;
|
||||||
|
|
|
@ -6,6 +6,25 @@ use quote::{quote, ToTokens};
|
||||||
const RFC3986_UNRESERVED: [char; 4] = ['-', '.', '_', '~'];
|
const RFC3986_UNRESERVED: [char; 4] = ['-', '.', '_', '~'];
|
||||||
const RFC3986_PCHAR_OTHER: [char; 1] = ['@'];
|
const RFC3986_PCHAR_OTHER: [char; 1] = ['@'];
|
||||||
|
|
||||||
|
/// Constructs a path for use in a [`leptos_router::Route`] definition.
|
||||||
|
///
|
||||||
|
/// Note that this is an optional convenience. Manually defining route segments
|
||||||
|
/// is equivalent.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// use leptos_router::{path, ParamSegment, StaticSegment, WildcardSegment};
|
||||||
|
///
|
||||||
|
/// let path = path!("/foo/:bar/*any");
|
||||||
|
/// let output = (
|
||||||
|
/// StaticSegment("foo"),
|
||||||
|
/// ParamSegment("bar"),
|
||||||
|
/// WildcardSegment("any"),
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// assert_eq!(path, output);
|
||||||
|
/// ```
|
||||||
#[proc_macro_error::proc_macro_error]
|
#[proc_macro_error::proc_macro_error]
|
||||||
#[proc_macro]
|
#[proc_macro]
|
||||||
pub fn path(tokens: TokenStream) -> TokenStream {
|
pub fn path(tokens: TokenStream) -> TokenStream {
|
||||||
|
|
Loading…
Reference in a new issue