Skip to content

Commit

Permalink
expose some internals of routing to make wrappers easier
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj committed Nov 11, 2024
1 parent bb0dff6 commit 87d9dcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion router/src/matching/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod vertical;
use crate::{static_routes::RegenerationFn, Method, SsrMode};
pub use horizontal::*;
pub use nested::*;
use std::{borrow::Cow, collections::HashSet};
use std::{borrow::Cow, collections::HashSet, sync::atomic::Ordering};
pub use vertical::*;

#[derive(Debug)]
Expand Down Expand Up @@ -92,6 +92,13 @@ where
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct RouteMatchId(pub(crate) u16);

impl RouteMatchId {
///
pub fn new_from_route_id() -> RouteMatchId {
RouteMatchId(ROUTE_ID.fetch_add(1, Ordering::Relaxed))
}
}

pub trait MatchInterface {
type Child: MatchInterface + MatchParams + 'static;

Expand Down
2 changes: 1 addition & 1 deletion router/src/matching/nested/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{

mod tuples;

static ROUTE_ID: AtomicU16 = AtomicU16::new(1);
pub(crate) static ROUTE_ID: AtomicU16 = AtomicU16::new(1);

#[derive(Debug, PartialEq, Eq)]
pub struct NestedRoute<Segments, Children, Data, View> {
Expand Down

0 comments on commit 87d9dcd

Please sign in to comment.