Function actix::fut::ok [] [src]

pub fn ok<T, E, S>(t: T) -> FutureResult<T, E, S>

Creates a "leaf future" from an immediate value of a finished and successful computation.

The returned future is similar to result where it will immediately run a scheduled callback with the provided value.

Examples

use actix::{Actor, Context};
use actix::fut::*;

struct MyActor;
impl Actor for MyActor {
   type Context = Context<Self>;
}

let future_of_1 = ok::<u32, u32, MyActor>(1);