# SharedReceiver

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-system/task/oneshot/struct-sharedreceiver/

**struct** · [`ferroui-system`](/docs/0.5.0/api/ferroui-system/) · v0.5.0

```rust
struct SharedReceiver<T>
```

A receiver for several waiters (`Receiver::shared`): each clone is a future of a copy of the
value, or of [`Canceled`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-canceled/); the value stays in the channel for every clone, the ones made later
included. The awaiting clones are woken in the order they first waited, and a task that awaits
several of them is woken once.

The sender is closed (`Sender::is_closed`) when every clone is gone.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/oneshot.rs#L286)

## Members

- [`try_recv`](#function-try_recv)
- [`blocking_recv`](#function-blocking_recv)
- [`recv_timeout`](#function-recv_timeout)
- [`is_finished`](#function-is_finished)
- [`flatten`](#function-flatten)

<a id="function-try_recv"></a>

### try_recv

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

A copy of the value when it was sent (`Ok(Some)`), `Ok(None)` while it was not, and
`Canceled` when the sender was dropped without sending.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/oneshot.rs#L294)

<a id="function-blocking_recv"></a>

### blocking_recv

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/oneshot.rs#L301)

<a id="function-recv_timeout"></a>

### recv_timeout

```rust
fn recv_timeout(self: &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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/oneshot.rs#L308)

<a id="function-is_finished"></a>

### is_finished

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/oneshot.rs#L324)

<a id="function-flatten"></a>

### flatten

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/oneshot.rs#L332)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `IntoFuture`
- `ToOwned`
- `Clone`
- `Future`
- `Drop`
- `Debug`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
