[][src]Struct goods::Handle

pub struct Handle<A: Asset> { /* fields omitted */ }

Handle for an asset of type A that eventually resolves to the asset instance or an error.

Handle implements Future which helps with compound asset loading. Unlike many Futures Handle semantically is just a pointer to the place where asset isntance will be. So polling Handle isn't necessary for asset to be loaded. When asset is finally loaded any task that polled Handle will be notified.

Implementations

impl<A> Handle<A> where
    A: Asset
[src]

pub fn query(&self) -> Poll<&Result<A, Error<A>>>[src]

Queries for the asset state. Returns Poll::Ready(Ok(asset)) if asset was successfully loaded. Returns Poll::Ready(Err(error)) if error occured. Otherwise returns Poll::Pending as asset wasn't yet loaded.

pub fn is_pending(&self) -> bool[src]

Checks if asset referenced by this handle is not loaded yet.

pub fn is_ready(&self) -> bool[src]

Checks if loading of the asset referenced by this handle is complete.

pub fn is_err(&self) -> bool[src]

Checks if loading of the asset referenced by this handle failed.

pub fn is_ok(&self) -> bool[src]

Checks if loading of the asset referenced by this handle succeeded.

pub fn get(&self) -> Option<&A>[src]

Returns asset instance if it's loaded.

Trait Implementations

impl<A: Clone + Asset> Clone for Handle<A>[src]

impl<A> Eq for Handle<A> where
    A: Asset
[src]

impl<A> Future for Handle<A> where
    A: Asset
[src]

type Output = Result<A, Error<A>>

The type of value produced on completion.

impl<A> Hash for Handle<A> where
    A: Asset
[src]

impl<A> PartialEq<Handle<A>> for Handle<A> where
    A: Asset
[src]

Auto Trait Implementations

impl<A> !RefUnwindSafe for Handle<A>

impl<A> !Send for Handle<A>

impl<A> !Sync for Handle<A>

impl<A> Unpin for Handle<A>

impl<A> !UnwindSafe for Handle<A>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T> Key for T where
    T: Eq + Hash + Clone + MaybeSend + MaybeSync + 'static, 
[src]

impl<T> MaybeSend for T where
    T: ?Sized
[src]

impl<T> MaybeSync for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.