Skip to content

Commit 6566800

Browse files
authored
make PathTree & Node cloneable (#35)
1 parent b55432b commit 6566800

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/lib.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,16 @@ use alloc::{
143143
vec::Vec,
144144
};
145145
use core::str::from_utf8;
146-
147146
use smallvec::SmallVec;
148147

149148
mod node;
150-
mod parser;
151-
152149
pub use node::{Key, Node};
150+
151+
mod parser;
153152
pub use parser::{Kind, Parser, Piece, Position};
154153

155154
/// A path tree.
156-
#[derive(Debug)]
155+
#[derive(Clone, Debug)]
157156
pub struct PathTree<T> {
158157
id: usize,
159158
routes: Vec<(T, Vec<Piece>)>,
@@ -208,7 +207,7 @@ impl<T> PathTree<T> {
208207
}
209208
}
210209

211-
/// Returns the [Path] by the given path.
210+
/// Returns the [`Path`] by the given path.
212211
#[must_use]
213212
pub fn find<'a, 'b>(&'a self, path: &'b str) -> Option<(&T, Path<'a, 'b>)> {
214213
let bytes = path.as_bytes();

src/node.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub enum Key {
1515
Parameter(Kind),
1616
}
1717

18+
#[derive(Clone)]
1819
pub struct Node<T> {
1920
pub key: Key,
2021
pub value: Option<T>,

0 commit comments

Comments
 (0)