Enum gluon_vm::future::FutureValue [−][src]
FutureValue
holds either an already computed value or a Future
which can be resolved into
that value. This makes it possible to avoid creating an event loop for computions which run
synchronously.
Variants
Value(Result<F::Item, F::Error>)
Future(F)
Polled
Methods
impl<F> FutureValue<F> where
F: Future,
F::Error: From<Error>,
[src]
impl<F> FutureValue<F> where
F: Future,
F::Error: From<Error>,
pub fn sync_or_error(self) -> Result<F::Item, F::Error>
[src]
pub fn sync_or_error(self) -> Result<F::Item, F::Error>
Returns the resolved value
if it was synchronously computed or an error otherwise
impl<T, E> FutureValue<FutureResult<T, E>>
[src]
impl<T, E> FutureValue<FutureResult<T, E>>
pub fn sync(result: Result<T, E>) -> FutureValue<FutureResult<T, E>>
[src]
pub fn sync(result: Result<T, E>) -> FutureValue<FutureResult<T, E>>
impl<'f, F> FutureValue<F> where
F: Future + 'f,
[src]
impl<'f, F> FutureValue<F> where
F: Future + 'f,
pub fn boxed(
self
) -> FutureValue<Box<Future<Item = F::Item, Error = F::Error> + Send + 'f>> where
F: Send,
[src]
pub fn boxed(
self
) -> FutureValue<Box<Future<Item = F::Item, Error = F::Error> + Send + 'f>> where
F: Send,
pub fn map<G, U>(self, g: G) -> FutureValue<Map<F, G>> where
G: FnOnce(F::Item) -> U,
[src]
pub fn map<G, U>(self, g: G) -> FutureValue<Map<F, G>> where
G: FnOnce(F::Item) -> U,
pub fn map_err<G, U>(self, g: G) -> FutureValue<MapErr<F, G>> where
G: FnOnce(F::Error) -> U,
[src]
pub fn map_err<G, U>(self, g: G) -> FutureValue<MapErr<F, G>> where
G: FnOnce(F::Error) -> U,
pub fn and_then<G, B>(
self,
g: G
) -> FutureValue<Either<B, AndThen<F, FutureValue<B>, G>>> where
G: FnOnce(F::Item) -> FutureValue<B>,
B: Future<Error = F::Error>,
[src]
pub fn and_then<G, B>(
self,
g: G
) -> FutureValue<Either<B, AndThen<F, FutureValue<B>, G>>> where
G: FnOnce(F::Item) -> FutureValue<B>,
B: Future<Error = F::Error>,
pub fn then<G, B>(
self,
g: G
) -> FutureValue<Either<B, Then<F, FutureValue<B>, G>>> where
G: FnOnce(Result<F::Item, F::Error>) -> FutureValue<B>,
B: Future,
[src]
pub fn then<G, B>(
self,
g: G
) -> FutureValue<Either<B, Then<F, FutureValue<B>, G>>> where
G: FnOnce(Result<F::Item, F::Error>) -> FutureValue<B>,
B: Future,
pub fn or_else<G, B>(
self,
g: G
) -> FutureValue<Either<B, OrElse<F, FutureValue<B>, G>>> where
G: FnOnce(F::Error) -> FutureValue<B>,
B: Future<Item = F::Item>,
[src]
pub fn or_else<G, B>(
self,
g: G
) -> FutureValue<Either<B, OrElse<F, FutureValue<B>, G>>> where
G: FnOnce(F::Error) -> FutureValue<B>,
B: Future<Item = F::Item>,
Trait Implementations
impl<F> VmType for FutureValue<F> where
F: Future,
F::Item: VmType,
[src]
impl<F> VmType for FutureValue<F> where
F: Future,
F::Item: VmType,
type Type = <F::Item as VmType>::Type
A version of Self
which implements Any
allowing a TypeId
to be retrieved
fn make_type(vm: &Thread) -> ArcType
[src]
fn make_type(vm: &Thread) -> ArcType
Creates an gluon type which maps to Self
in rust
fn extra_args() -> VmIndex
[src]
fn extra_args() -> VmIndex
How many extra arguments a function returning this type requires. Used for abstract types which when used in return position should act like they still need more arguments before they are called Read more
fn make_forall_type(vm: &Thread) -> ArcType
[src]
fn make_forall_type(vm: &Thread) -> ArcType
impl<'vm, F> AsyncPushable<'vm> for FutureValue<F> where
F: Future<Error = Error> + Send + 'static,
F::Item: Pushable<'vm>,
[src]
impl<'vm, F> AsyncPushable<'vm> for FutureValue<F> where
F: Future<Error = Error> + Send + 'static,
F::Item: Pushable<'vm>,
fn async_push(
self,
thread: &'vm Thread,
context: &mut Context,
lock: Lock
) -> Result<Async<()>>
[src]
fn async_push(
self,
thread: &'vm Thread,
context: &mut Context,
lock: Lock
) -> Result<Async<()>>
Pushes self
to stack
. If the call is successful a single element should have been added to the stack and Ok(())
should be returned. If the call is unsuccessful Status:Error
should be returned and the stack should be left intact. Read more
fn async_status_push(
self,
vm: &'vm Thread,
context: &mut Context,
lock: Lock
) -> Status where
Self: Sized,
[src]
fn async_status_push(
self,
vm: &'vm Thread,
context: &mut Context,
lock: Lock
) -> Status where
Self: Sized,
impl<T, E> From<Result<T, E>> for FutureValue<FutureResult<T, E>>
[src]
impl<T, E> From<Result<T, E>> for FutureValue<FutureResult<T, E>>
fn from(result: Result<T, E>) -> FutureValue<FutureResult<T, E>>
[src]
fn from(result: Result<T, E>) -> FutureValue<FutureResult<T, E>>
Performs the conversion.
impl<F> Future for FutureValue<F> where
F: Future,
[src]
impl<F> Future for FutureValue<F> where
F: Future,
type Item = F::Item
The type of value that this future will resolved with if it is successful. Read more
type Error = F::Error
The type of error that this future will resolve with if it fails in a normal fashion. Read more
fn poll(&mut self) -> Poll<F::Item, F::Error>
[src]
fn poll(&mut self) -> Poll<F::Item, F::Error>
Query this future to see if its value has become available, registering interest if it is not. Read more
fn wait(self) -> Result<F::Item, F::Error>
[src]
fn wait(self) -> Result<F::Item, F::Error>
Block the current thread until this future is resolved. Read more
fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,
[src]
fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,
Map this future's result to a different type, returning a new future of the resulting type. Read more
fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
[src]
fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
Map this future's error to a different error, returning a new future. Read more
fn from_err<E>(self) -> FromErr<Self, E> where
E: From<Self::Error>,
[src]
fn from_err<E>(self) -> FromErr<Self, E> where
E: From<Self::Error>,
Map this future's error to any error implementing From
for this future's Error
, returning a new future. Read more
fn then<F, B>(self, f: F) -> Then<Self, B, F> where
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
[src]
fn then<F, B>(self, f: F) -> Then<Self, B, F> where
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
Chain on a computation for when a future finished, passing the result of the future to the provided closure f
. Read more
fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,
[src]
fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,
Execute another future after this one has resolved successfully. Read more
fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> where
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,
[src]
fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> where
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,
Execute another future if this one resolves with an error. Read more
fn select<B>(self, other: B) -> Select<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
[src]
fn select<B>(self, other: B) -> Select<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
Waits for either one of two futures to complete. Read more
fn select2<B>(self, other: B) -> Select2<Self, <B as IntoFuture>::Future> where
B: IntoFuture,
[src]
fn select2<B>(self, other: B) -> Select2<Self, <B as IntoFuture>::Future> where
B: IntoFuture,
Waits for either one of two differently-typed futures to complete. Read more
fn join<B>(self, other: B) -> Join<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
[src]
fn join<B>(self, other: B) -> Join<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
Joins the result of two futures, waiting for them both to complete. Read more
fn join3<B, C>(
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
[src]
fn join3<B, C>(
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn join4<B, C, D>(
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
[src]
fn join4<B, C, D>(
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn join5<B, C, D, E>(
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
[src]
fn join5<B, C, D, E>(
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn into_stream(self) -> IntoStream<Self>
[src]
fn into_stream(self) -> IntoStream<Self>
Convert this future into a single element stream. Read more
fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
[src]
fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
Flatten the execution of this future when the successful result of this future is itself another future. Read more
fn flatten_stream(self) -> FlattenStream<Self> where
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
[src]
fn flatten_stream(self) -> FlattenStream<Self> where
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
Flatten the execution of this future when the successful result of this future is a stream. Read more
fn fuse(self) -> Fuse<Self>
[src]
fn fuse(self) -> Fuse<Self>
Fuse a future such that poll
will never again be called once it has completed. Read more
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Item),
[src]
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Item),
Do something with the item of a future, passing it on. Read more
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
[src]
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
Catches unwinding panics while polling the future. Read more
Create a cloneable handle to this future where all handles will resolve to the same result. Read more