Struct actix::msgs::Execute [−][src]
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
I: Send + 'static,
E: Send + 'static,
[src]
impl<I, E> Execute<I, E> where
I: Send + 'static,
E: Send + 'static,
pub fn new<F>(f: F) -> Self where
F: FnOnce() -> Result<I, E> + Send + 'static,
[src]
pub fn new<F>(f: F) -> Self where
F: FnOnce() -> Result<I, E> + Send + 'static,
pub fn exec(self) -> Result<I, E>
[src]
pub fn exec(self) -> Result<I, E>
Execute enclosed function
Trait Implementations
impl<I: Send, E: Send> Handler<Execute<I, E>> for Arbiter
[src]
impl<I: Send, E: Send> Handler<Execute<I, E>> for Arbiter
type Result = Result<I, E>
The type of value that this handle will return
fn handle(&mut self, msg: Execute<I, E>, _: &mut Context<Self>) -> Result<I, E>
[src]
fn handle(&mut self, msg: Execute<I, E>, _: &mut Context<Self>) -> Result<I, E>
Method is called for every message received by this Actor
impl<I: Send, E: Send> Message for Execute<I, E>
[src]
impl<I: Send, E: Send> Message for Execute<I, E>
Execute message response