New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync: add mpsc::Sender::capacity
#3690
Conversation
tokio/src/sync/mpsc/bounded.rs
Outdated
/// assert_eq!(tx.available_permits(), 5); | ||
/// } | ||
/// ``` | ||
pub fn available_permits(&self) -> usize { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to capacity
.
tokio/src/sync/mpsc/bounded.rs
Outdated
/// Returns the number of available permits in the channel. | ||
/// | ||
/// # Examples |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
mpsc::Sender::available_permits
mpsc::Sender::capacity
Fixes #2642