logo
pub struct Promise<A> {
    pub has_result: bool,
    pub success: Signal1<A>,
    pub error: Signal1<String>,
    pub progress_changed: Signal0,
    pub result: Option<A>,
    pub progress: f32,
    pub total: f32,
}
Expand description

Represents a value that isn’t ready yet, but may become available in the future.

Fields

has_result: bool

Whether the result is available yet.

success: Signal1<A>

Emitted when the promise is fulfilled and the result has become available.

error: Signal1<String>

An error message emitted if there was a problem during loading.

progress_changed: Signal0

May be emitted during loading when the progress or total counts have been updated.

result: Option<A>

The end result fulfilled by the promise. When accessing, throws an error if the result is not yet available. Read hasResult to check availability first, or use get(). When setting, throws an error if the result was already previously assigned.

progress: f32

Context on how close this promise is to being fulfilled. For file IO, these are in bytes.

total: f32

Implementations

Passes the result to the callback now if the result is available, otherwise calls it later. @returns If the callback was not called yet, a handle that can be disposed to cancel the request.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Typed getter

Inspect the context.

Inspect the context.

Inspect the context.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert into color

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Sets value as a parameter of self.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.