Macro actix_service::always_ready

source ·
macro_rules! always_ready {
    () => { ... };
}
Expand description

An implementation of poll_ready that always signals readiness.

This should only be used for basic leaf services that have no concept of un-readiness. For wrapper or other service types, use [forward_ready!] for simple cases or write a bespoke poll_ready implementation.

§Examples

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

struct IdentityService;

impl Service<u32> for IdentityService {
    type Response = u32;
    type Error = ();
    type Future = Ready<Result<Self::Response, Self::Error>>;

    actix_service::always_ready!();

    fn call(&self, req: u32) -> Self::Future {
        ready(Ok(req))
    }
}