Skip to content

Commit

Permalink
Properly document functions behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Oct 4, 2023
1 parent 02da4e5 commit 46a85f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions metered-channel/src/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ impl<T> MeteredReceiver<T> {
}

/// Attempt to receive the next item.
/// This function returns:
///
/// Ok(Some(t)) when message is fetched
/// Ok(None) when channel is closed and no messages left in the queue
/// Err(e) when there are no messages available, but channel is not yet closed
#[cfg(feature = "futures_channel")]
pub fn try_next(&mut self) -> Result<Option<T>, TryRecvError> {
if let Some(priority_channel) = &mut self.priority_channel {
Expand All @@ -294,6 +299,11 @@ impl<T> MeteredReceiver<T> {
}

/// Attempt to receive the next item.
/// This function returns:
///
/// Ok(Some(t)) when message is fetched
/// Ok(None) when channel is closed and no messages left in the queue
/// Err(e) when there are no messages available, but channel is not yet closed
#[cfg(feature = "async_channel")]
pub fn try_next(&mut self) -> Result<Option<T>, TryRecvError> {
if let Some(priority_channel) = &mut self.priority_channel {
Expand Down

0 comments on commit 46a85f6

Please sign in to comment.