Skip to content

Commit cd9b462

Browse files
committed
add key and value 'static lifetimes to captures
1 parent e5d1ba9 commit cd9b462

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/request.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@ pin_project_lite::pin_project! {
2727
pub(crate) state: State,
2828
#[pin]
2929
pub(crate) req: http::Request,
30-
pub(crate) route_params: Vec<Captures>,
30+
pub(crate) route_params: Vec<Captures<'static, 'static>>,
3131
}
3232
}
3333

3434
impl<State> Request<State> {
3535
/// Create a new `Request`.
36-
pub(crate) fn new(state: State, req: http_types::Request, route_params: Vec<Captures>) -> Self {
36+
pub(crate) fn new(
37+
state: State,
38+
req: http_types::Request,
39+
route_params: Vec<Captures<'static, 'static>>,
40+
) -> Self {
3741
Self {
3842
state,
3943
req,

src/router.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<State> std::fmt::Debug for Router<State> {
2626
/// The result of routing a URL
2727
pub(crate) struct Selection<'a, State> {
2828
pub(crate) endpoint: &'a DynEndpoint<State>,
29-
pub(crate) params: Captures,
29+
pub(crate) params: Captures<'static, 'static>,
3030
}
3131

3232
impl<State: Clone + Send + Sync + 'static> Router<State> {
@@ -62,12 +62,12 @@ impl<State: Clone + Send + Sync + 'static> Router<State> {
6262
{
6363
Selection {
6464
endpoint: m.handler(),
65-
params: m.captures(),
65+
params: m.captures().into_owned(),
6666
}
6767
} else if let Some(m) = self.all_method_router.best_match(path) {
6868
Selection {
6969
endpoint: m.handler(),
70-
params: m.captures(),
70+
params: m.captures().into_owned(),
7171
}
7272
} else if method == http_types::Method::Head {
7373
// If it is a HTTP HEAD request then check if there is a callback in the endpoints map

0 commit comments

Comments
 (0)