rename cell to rcrefcell

This commit is contained in:
Maxim Vorobjov 2020-06-26 18:48:26 +03:00
parent 2456d1fc8d
commit 2d85225e24
No known key found for this signature in database
GPG Key ID: 3A6CF6ADF8859751
3 changed files with 10 additions and 10 deletions

View File

@ -4,13 +4,13 @@ use std::rc::Rc;
use std::task::{Context, Poll};
use super::{Service, ServiceFactory};
use crate::axcell::AXCell;
use crate::rcrefcell::RcRefCell;
/// Service for the `and_then` combinator, chaining a computation onto the end
/// of another service which completes successfully.
///
/// 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> {
/// Create new `AndThen` combinator
@ -19,7 +19,7 @@ impl<A, B> AndThenService<A, B> {
A: Service,
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,
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),
Empty,
}

View File

@ -13,7 +13,7 @@ mod apply;
mod apply_cfg;
pub mod boxed;
mod cell;
mod axcell;
mod rcrefcell;
mod fn_service;
mod map;
mod map_config;

View File

@ -2,11 +2,11 @@
use std::task::{Context, Poll};
use std::{cell::{RefCell, RefMut}, fmt, rc::Rc};
pub(crate) struct AXCell<T> {
pub(crate) struct RcRefCell<T> {
inner: Rc<RefCell<T>>,
}
impl<T> Clone for AXCell<T> {
impl<T> Clone for RcRefCell<T> {
fn clone(&self) -> Self {
Self {
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 {
self.inner.fmt(f)
}
}
impl<T> AXCell<T> {
impl<T> RcRefCell<T> {
pub(crate) fn new(inner: T) -> Self {
Self {
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 Response = T::Response;
type Error = T::Error;