Struct tiny_future::Future[][src]

pub struct Future<T, U = ()>(_);

Methods

impl<T, U> Future<T, U>
[src]

Creates a new Future<T, U> with shared_state as shared-state

Sets the future

Cancels (poisons) the future

This is useful to indicate that the future is obsolete and should not be set anymore

Returns the future's state

Checks if the future is still waiting or has been set/canceled

Tries to get the future's result

If the future is ready, it is consumed and T is returned; if the future is not ready, Error::InvalidState(State) is returned

Tries to get the future's result

If the future is ready or or becomes ready before the timeout occurres, it is consumed and T is returned; if the future is not ready, Error::InvalidState(State) is returned

Gets the future's result

Warning: this function will block until a result becomes available

Get a clone of the current shared state

Replace the current shared state

Provides exclusive access to the shared state within modifier until modifier returns

Provides exclusive access to the shared state within modifier until modifier returns

Detaches the future so it won't be canceled if there is only one instance left

Useful if you either don't want that your future is ever canceled or if there's always only one instance (e.g. if you wrap it into a reference-counting container)

impl<T> Future<T, ()>
[src]

Trait Implementations

impl<T, U> Default for Future<T, U> where
    U: Default
[src]

Returns the "default value" for a type. Read more

impl<T, U> Drop for Future<T, U>
[src]

Executes the destructor for this type. Read more

impl<T, U> Clone for Future<T, U>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T, U> Send for Future<T, U>
[src]

impl<T, U> Sync for Future<T, U>
[src]