Skip to content

Conversation

@davidpdrsn
Copy link
Member

Fixes #2642

@davidpdrsn davidpdrsn added A-tokio Area: The main tokio crate M-sync Module: tokio/sync labels Apr 10, 2021
/// assert_eq!(tx.available_permits(), 5);
/// }
/// ```
pub fn available_permits(&self) -> usize {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should probably not be called available_permits.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to capacity.

Comment on lines 703 to 705
/// Returns the number of available permits in the channel.
///
/// # Examples
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine that you use reserve in the example, but it'd be nice to mention up here too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tweaked the docs a bit. Let me know what you think.

@davidpdrsn davidpdrsn changed the title sync: add mpsc::Sender::available_permits sync: add mpsc::Sender::capacity Apr 11, 2021
@davidpdrsn davidpdrsn requested a review from Darksonn April 11, 2021 17:43
@davidpdrsn davidpdrsn merged commit 08f1b67 into master Apr 12, 2021
@davidpdrsn davidpdrsn deleted the david/mpsc-sender-available-permits branch April 12, 2021 07:23
@Darksonn Darksonn mentioned this pull request Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-sync Module: tokio/sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monitor channel buffer capacity

3 participants