mirror of https://github.com/fafhrd91/actix-net
rename cell to rcrefcell
This commit is contained in:
parent
2456d1fc8d
commit
2d85225e24
|
@ -4,13 +4,13 @@ use std::rc::Rc;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
use super::{Service, ServiceFactory};
|
use super::{Service, ServiceFactory};
|
||||||
use crate::axcell::AXCell;
|
use crate::rcrefcell::RcRefCell;
|
||||||
|
|
||||||
/// Service for the `and_then` combinator, chaining a computation onto the end
|
/// Service for the `and_then` combinator, chaining a computation onto the end
|
||||||
/// of another service which completes successfully.
|
/// of another service which completes successfully.
|
||||||
///
|
///
|
||||||
/// This is created by the `ServiceExt::and_then` method.
|
/// This is created by the `ServiceExt::and_then` method.
|
||||||
pub(crate) struct AndThenService<A, B>(AXCell<(A, B)>);
|
pub(crate) struct AndThenService<A, B>(RcRefCell<(A, B)>);
|
||||||
|
|
||||||
impl<A, B> AndThenService<A, B> {
|
impl<A, B> AndThenService<A, B> {
|
||||||
/// Create new `AndThen` combinator
|
/// Create new `AndThen` combinator
|
||||||
|
@ -19,7 +19,7 @@ impl<A, B> AndThenService<A, B> {
|
||||||
A: Service,
|
A: Service,
|
||||||
B: Service<Request = A::Response, Error = A::Error>,
|
B: Service<Request = A::Response, Error = A::Error>,
|
||||||
{
|
{
|
||||||
Self(AXCell::new((a, b)))
|
Self(RcRefCell::new((a, b)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ where
|
||||||
A: Service,
|
A: Service,
|
||||||
B: Service<Request = A::Response, Error = A::Error>,
|
B: Service<Request = A::Response, Error = A::Error>,
|
||||||
{
|
{
|
||||||
A(#[pin] A::Future, Option<AXCell<(A, B)>>),
|
A(#[pin] A::Future, Option<RcRefCell<(A, B)>>),
|
||||||
B(#[pin] B::Future),
|
B(#[pin] B::Future),
|
||||||
Empty,
|
Empty,
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ mod apply;
|
||||||
mod apply_cfg;
|
mod apply_cfg;
|
||||||
pub mod boxed;
|
pub mod boxed;
|
||||||
mod cell;
|
mod cell;
|
||||||
mod axcell;
|
mod rcrefcell;
|
||||||
mod fn_service;
|
mod fn_service;
|
||||||
mod map;
|
mod map;
|
||||||
mod map_config;
|
mod map_config;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use std::{cell::{RefCell, RefMut}, fmt, rc::Rc};
|
use std::{cell::{RefCell, RefMut}, fmt, rc::Rc};
|
||||||
|
|
||||||
pub(crate) struct AXCell<T> {
|
pub(crate) struct RcRefCell<T> {
|
||||||
inner: Rc<RefCell<T>>,
|
inner: Rc<RefCell<T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Clone for AXCell<T> {
|
impl<T> Clone for RcRefCell<T> {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner: self.inner.clone(),
|
inner: self.inner.clone(),
|
||||||
|
@ -14,13 +14,13 @@ impl<T> Clone for AXCell<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: fmt::Debug> fmt::Debug for AXCell<T> {
|
impl<T: fmt::Debug> fmt::Debug for RcRefCell<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
self.inner.fmt(f)
|
self.inner.fmt(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> AXCell<T> {
|
impl<T> RcRefCell<T> {
|
||||||
pub(crate) fn new(inner: T) -> Self {
|
pub(crate) fn new(inner: T) -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner: Rc::new(RefCell::new(inner)),
|
inner: Rc::new(RefCell::new(inner)),
|
||||||
|
@ -32,7 +32,7 @@ impl<T> AXCell<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: crate::Service> crate::Service for AXCell<T> {
|
impl<T: crate::Service> crate::Service for RcRefCell<T> {
|
||||||
type Request = T::Request;
|
type Request = T::Request;
|
||||||
type Response = T::Response;
|
type Response = T::Response;
|
||||||
type Error = T::Error;
|
type Error = T::Error;
|
Loading…
Reference in New Issue