Skip to content

Commit

Permalink
make Ctx copy
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Jun 15, 2023
1 parent 01b4a9b commit 09be787
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ntex-service/src/and_then.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ where
AndThenServiceResponse {
slf: self,
state: State::A {
fut: ctx.clone().call(&self.svc1, req),
fut: ctx.call(&self.svc1, req),
ctx: Some(ctx),
},
}
Expand Down
11 changes: 1 addition & 10 deletions ntex-service/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl<S> Drop for Container<S> {
}
}

#[derive(Copy, Clone)]

Check warning on line 117 in ntex-service/src/ctx.rs

View check run for this annotation

Codecov / codecov/patch

ntex-service/src/ctx.rs#L117

Added line #L117 was not covered by tests
pub struct Ctx<'b, S: ?Sized> {
index: usize,
waiters: &'b Rc<RefCell<slab::Slab<Option<task::Waker>>>>,
Expand Down Expand Up @@ -172,16 +173,6 @@ impl<'b, S: ?Sized> Ctx<'b, S> {
}
}

impl<'b, S: ?Sized> Clone for Ctx<'b, S> {
fn clone(&self) -> Self {
Self {
index: self.index,
waiters: self.waiters,
_t: marker::PhantomData,
}
}
}

pin_project_lite::pin_project! {
#[must_use = "futures do nothing unless polled"]
pub struct ServiceCall<'a, T, Req>
Expand Down

0 comments on commit 09be787

Please sign in to comment.