Trait hitbox_actix::messages::IntoCache [−][src]
pub trait IntoCache: Cacheable { fn into_cache<A>(self, upstream: &Addr<A>) -> QueryCache<A, Self>
where
A: Actor,
Self: Message + Send + Sized,
Self::Result: MessageResponse<A, Self> + Send + 'static, { ... } }
Expand description
Trait describes coversion from any actix::Message into QueryCache message.
Provided methods
fn into_cache<A>(self, upstream: &Addr<A>) -> QueryCache<A, Self> where
A: Actor,
Self: Message + Send + Sized,
Self::Result: MessageResponse<A, Self> + Send + 'static,
[src]
fn into_cache<A>(self, upstream: &Addr<A>) -> QueryCache<A, Self> where
A: Actor,
Self: Message + Send + Sized,
Self::Result: MessageResponse<A, Self> + Send + 'static,
[src]Helper method to convert Message into QueryCache message.
Examples
use actix::prelude::*; use hitbox_actix::prelude::*; use serde::Serialize; struct Upstream; impl Actor for Upstream { type Context = Context<Self>; } #[derive(Cacheable, Serialize, Message, Debug, PartialEq)] #[rtype(result = "()")] struct QueryNothing { id: Option<i32>, } #[actix_rt::main] async fn main() { let upstream = Upstream.start(); let query = QueryNothing { id: Some(1) } .into_cache(&upstream); }