async fn new_middleware(
        &self,
        previous: Option<&Self::Middleware>,
    ) -> Result<Self::Middleware> {
        let current = self.current().await;

        if let Some(previous) = previous {
            // if std::ptr::eq(current.as_ref(), previous) {
            if self.middleware_eq(previous).await {
                // Get inner middleware and inner factory
                let current_inner = current.inner();
                let inner_factory = self.inner_factory().await;

                // Recursively call `new_middleware` on inner factory.
                let new_inner =
                    inner_factory.new_middleware(Some(current_inner)).await?;

                // Now that we have the new inner middleware, we create out own,
                // setting the current to it.
                let new_middleware =
                    self.build_and_set_middleware(new_inner).await;

                return Ok(new_middleware);
            }
        }

        Ok(current)
    }
/// Automatic implementation of `new_middleware`. This function receives a
/// optional middleware. If it is `None`, it will return the current
/// internal middleware. Otherwise, it will compare the given middleware
/// with the current internal middleware. If they are different, it will
/// return the current internal middleware. Otherwise, it will create a new
/// one, calling on the chain of factories to build a middleware. In all
/// cases, the returned middleware is always different than the given one.
Automatic implementation of `new_middleware`. This function receives a
optional middleware. If it is `None`, it will return the current
internal middleware. Otherwise, it will compare the given middleware
with the current internal middleware. If they are different, it will
return the current internal middleware. Otherwise, it will create a new
one, calling on the chain of factories to build a middleware. In all
cases, the returned middleware is always different than the given one.
Automatic implementation of ` new_middleware ` . This function receives a optional middleware . If it is ` None ` it will return the current internal middleware . Otherwise it will compare the given middleware with the current internal middleware . If they are different it will return the current internal middleware . Otherwise it will create a new one calling on the chain of factories to build a middleware . In all cases the returned middleware is always different than the given one .
async fn new_middleware(
        &self,
        previous: Option<&Self::Middleware>,
    ) -> Result<Self::Middleware> {
        let current = self.current().await;
        if let Some(previous) = previous {
            // if std::ptr::eq(current.as_ref(), previous) {
            if self.middleware_eq(previous).await {
                // Get inner middleware and inner factory
                let current_inner = current.inner();
                let inner_factory = self.inner_factory().await;
                // Recursively call `new_middleware` on inner factory.
                let new_inner =
                    inner_factory.new_middleware(Some(current_inner)).await?;
                // Now that we have the new inner middleware, we create out own,
                // setting the current to it.
                let new_middleware =
                    self.build_and_set_middleware(new_inner).await;
                return Ok(new_middleware);
            }
        }
        Ok(current)
    }
async fn new_middleware ( & self , previous : Option < & Self :: Middleware > , ) -> Result < Self :: Middleware > { let current = self . current ( ) . await ; if let Some ( previous ) = previous { // if std::ptr::eq(current.as_ref(), previous) { if self . middleware_eq ( previous ) . await { // Get inner middleware and inner factory let current_inner = current . inner ( ) ; let inner_factory = self . inner_factory ( ) . await ; // Recursively call `new_middleware` on inner factory. let new_inner = inner_factory . new_middleware ( Some ( current_inner ) ) . await ? ; // Now that we have the new inner middleware, we create out own, // setting the current to it. let new_middleware = self . build_and_set_middleware ( new_inner ) . await ; return Ok ( new_middleware ) ; } } Ok ( current ) }
Automatic implementation of `new_middleware`.
Automatic implementation of ` new_middleware ` .
&self
previous
Option<&Self::Middleware>