FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Receiver

    struct · ferroui-system · v0.5.0

    struct Receiver<T>
    

    The end of a channel that waits for the value: a future of it, or of Canceled when the sender was dropped without sending.

    The value is taken once: after the receiver gave it (as the output of a poll, or from try_recv), the channel is empty for good, and the receiver gives Canceled. Dropping the receiver makes Sender::send give the value back.

    View source

    Members

    try_recv

    fn try_recv(self: &mut Self) -> Result<Option<T>, Canceled>
    

    The value when it was sent (Ok(Some)), Ok(None) while it was not, and Canceled when the sender was dropped without sending, or the value was taken already.

    Source

    is_finished

    fn is_finished(self: &Self) -> bool
    

    Whether the channel has completed: the value was sent or the sender is gone, so that a poll is ready.

    Source

    blocking_recv

    fn blocking_recv(self: Self) -> Result<T, Canceled>
    

    Blocks the thread until the value is sent, or the sender is dropped.

    Never returns when the value is to be sent by work of this same thread.

    Source

    recv_timeout

    fn recv_timeout(self: &mut Self, timeout: Duration) -> Result<Option<T>, Canceled>
    

    Blocks the thread until the value is sent, the sender is dropped, or timeout has passed; Ok(None) is the timeout.

    Source

    shared

    fn shared(self: Self) -> SharedReceiver<T>
    where T: Clone
    

    A receiver for several waiters: see SharedReceiver.

    Source

    flatten

    fn flatten(self: Self) -> impl Future<Output = Result<T, crate::ObservableError>>
    

    A future of the result that the channel carries: what was sent, or the error Canceled when the sender was dropped without sending (SetCanceled).

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • IntoFuture
    • Future
    • Drop
    • Debug
    • From<Receiver<Result<T, Rc<dyn Error>>>>

    Availability

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