try_recv


Description:

public abstract Result<G> try_recv ()

Attempts to receive a value from the channel. This method doesn't block the thread and returns immediately, regardless of success.

Errors:

  • ChannelError.CLOSED

If the channel has been closed and no more data.

  • ChannelError.TRY_FAILED

If the channel is empty (bufferd or unbounded channel), or there are no send operations waiting for receive operations (unbuffered channel).

Returns:

the result which holds a value if succeeded, or an error if failed.