1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 16:02:59 +01:00

remove public Clone for Request

This commit is contained in:
Nikolay Kim 2018-07-04 22:57:40 +06:00
parent 5d79114239
commit d5606625a2
2 changed files with 9 additions and 4 deletions

View File

@ -74,7 +74,7 @@ impl<S> HttpRequest<S> {
pub(crate) fn with_state<NS>(&self, state: Rc<NS>) -> HttpRequest<NS> { pub(crate) fn with_state<NS>(&self, state: Rc<NS>) -> HttpRequest<NS> {
HttpRequest { HttpRequest {
state, state,
req: self.req.clone(), req: self.req.as_ref().map(|r| r.clone()),
route: self.route.clone(), route: self.route.clone(),
} }
} }
@ -84,7 +84,7 @@ impl<S> HttpRequest<S> {
pub(crate) fn with_route_info(&self, route: RouteInfo) -> HttpRequest<S> { pub(crate) fn with_route_info(&self, route: RouteInfo) -> HttpRequest<S> {
HttpRequest { HttpRequest {
route, route,
req: self.req.clone(), req: self.req.as_ref().map(|r| r.clone()),
state: self.state.clone(), state: self.state.clone(),
} }
} }
@ -327,7 +327,7 @@ impl<S> Drop for HttpRequest<S> {
impl<S> Clone for HttpRequest<S> { impl<S> Clone for HttpRequest<S> {
fn clone(&self) -> HttpRequest<S> { fn clone(&self) -> HttpRequest<S> {
HttpRequest { HttpRequest {
req: self.req.clone(), req: self.req.as_ref().map(|r| r.clone()),
state: self.state.clone(), state: self.state.clone(),
route: self.route.clone(), route: self.route.clone(),
} }

View File

@ -20,7 +20,6 @@ bitflags! {
} }
/// Request's context /// Request's context
#[derive(Clone)]
pub struct Request { pub struct Request {
pub(crate) inner: Rc<InnerRequest>, pub(crate) inner: Rc<InnerRequest>,
} }
@ -196,6 +195,12 @@ impl Request {
&self.inner().settings &self.inner().settings
} }
pub(crate) fn clone(&self) -> Self {
Request {
inner: self.inner.clone(),
}
}
pub(crate) fn release(self) { pub(crate) fn release(self) {
let mut inner = self.inner; let mut inner = self.inner;
if let Some(r) = Rc::get_mut(&mut inner) { if let Some(r) = Rc::get_mut(&mut inner) {