actix_service

Macro forward_ready

source
macro_rules! forward_ready {
    ($field:ident) => { ... };
}
Expand description

An implementation of poll_ready that forwards readiness checks to a named struct field.

Tuple structs are not supported.

ยงExamples

use actix_service::Service;
use futures_util::future::{ready, Ready};

struct WrapperService<S> {
    inner: S,
}

impl<S> Service<()> for WrapperService<S>
where
    S: Service<()>,
{
    type Response = S::Response;
    type Error = S::Error;
    type Future = S::Future;

    actix_service::forward_ready!(inner);

    fn call(&self, req: ()) -> Self::Future {
        self.inner.call(req)
    }
}