FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    TaskCompletionSource

    struct · ferroui-system · v0.5.0

    struct TaskCompletionSource<T>
    

    The producer side of a task that code ends by hand (TaskCompletionSource<TResult>).

    View source

    Deprecated since 0.5.0. use ferroui_system::task::oneshot::channel (a sender of a Result; dropping it cancels), or Shared::channel for synchronous continuations

    Members

    new

    fn new() -> Self
    

    A source with a task that has not ended.

    Source

    task

    fn task(self: &Self) -> Task<T>
    

    The task of the source (Task).

    Source

    set_result

    fn set_result(self: &Self, result: T)
    

    Ends the task with result (SetResult).

    Panics

    When the task has ended (InvalidOperationException).

    Source

    try_set_result

    fn try_set_result(self: &Self, result: T) -> bool
    

    Ends the task with result unless it has ended (TrySetResult).

    Source

    set_exception

    fn set_exception(self: &Self, error: ObservableError)
    

    Ends the task with error (SetException); a cancellation (Canceled, TaskCanceledError) cancels it.

    Panics

    When the task has ended (InvalidOperationException).

    Source

    try_set_exception

    fn try_set_exception(self: &Self, error: ObservableError) -> bool
    

    Ends the task with error unless it has ended (TrySetException).

    Source

    set_canceled

    fn set_canceled(self: &Self)
    

    Cancels the task (SetCanceled).

    Panics

    When the task has ended (InvalidOperationException).

    Source

    try_set_canceled

    fn try_set_canceled(self: &Self) -> bool
    

    Cancels the task unless it has ended (TrySetCanceled).

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • From<TaskCompletionSource<T>>
    • Default
    • Clone

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.