Skip to content

Commit

Permalink
sync: update Sender::try_reserve doc (#3476)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyd committed Jan 28, 2021
1 parent 34f1d3d commit 4968f59
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tokio/src/sync/mpsc/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ pub struct Sender<T> {

/// Permit to send one value into the channel.
///
/// `Permit` values are returned by [`Sender::reserve()`] and are used to
/// guarantee channel capacity before generating a message to send.
/// `Permit` values are returned by [`Sender::reserve()`] and [`Sender::try_reserve()`]
/// and are used to guarantee channel capacity before generating a message to send.
///
/// [`Sender::reserve()`]: Sender::reserve
/// [`Sender::try_reserve()`]: Sender::try_reserve
pub struct Permit<'a, T> {
chan: &'a chan::Tx<T, Semaphore>,
}
Expand Down Expand Up @@ -652,7 +653,7 @@ impl<T> Sender<T> {
/// If the channel is full this function will return [`TrySendError`], otherwise
/// if there is a slot available it will return a [`Permit`] that will then allow you
/// to [`send`] on the channel with a guaranteed slot. This function is similar to
/// [`reserve`] execpt it does not await for the slot to become available.
/// [`reserve`] except it does not await for the slot to become available.
///
/// Dropping [`Permit`] without sending a message releases the capacity back
/// to the channel.
Expand Down

0 comments on commit 4968f59

Please sign in to comment.