Struct actix_web::actix::msgs::Execute [−]
Execute function in arbiter's thread
Arbiter` actor handles Execute message.
Example
use actix::prelude::*; struct MyActor { addr: Addr<Arbiter>, } impl Actor for MyActor { type Context = Context<Self>; fn started(&mut self, ctx: &mut Context<Self>) { self.addr .do_send(actix::msgs::Execute::new(|| -> Result<(), ()> { // do something // ... Ok(()) })); } } fn main() {}
Methods
impl<I, E> Execute<I, E> where
E: Send + 'static,
I: Send + 'static,
impl<I, E> Execute<I, E> where
E: Send + 'static,
I: Send + 'static,
pub fn new<F>(f: F) -> Execute<I, E> where
F: FnOnce() -> Result<I, E> + Send + 'static,
pub fn new<F>(f: F) -> Execute<I, E> where
F: FnOnce() -> Result<I, E> + Send + 'static,
pub fn exec(self) -> Result<I, E>
pub fn exec(self) -> Result<I, E>
Execute enclosed function
Trait Implementations
impl<I, E> Message for Execute<I, E> where
E: Send,
I: Send,
impl<I, E> Message for Execute<I, E> where
E: Send,
I: Send,
Execute message response
type Result = Result<I, E>
The type of value that this message will resolved with if it is successful. Read more
impl<I, E> Handler<Execute<I, E>> for Arbiter where
E: Send,
I: Send,
impl<I, E> Handler<Execute<I, E>> for Arbiter where
E: Send,
I: Send,