public static Future <A> async(out Promise <A> promise) { var impl = new FutureImpl <A>(); promise = impl; return(new Future <A>(new OneOf <A, UnfulfilledFuture, IHeapFuture <A> >(impl))); }
public Future <B> map <B>(Fn <A, B> mapper) { var p = new FutureImpl <B>(); onComplete(v => p.complete(mapper(v))); return(p); }
public Future <B> flatMap <B>(Fn <A, Future <B> > mapper) { var p = new FutureImpl <B>(); onComplete(v => mapper(v).onComplete(p.complete)); return(p); }
public static Future <A> StartCoroutine <A>( Func <Promise <A>, IEnumerator> coroutine ) { var f = new FutureImpl <A>(); behaviour.StartCoroutine(coroutine(f)); return(f); }