-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
mpsc: Add Sender::try_reserve
function
#3418
Conversation
Co-authored-by: Alice Ryhl <[email protected]>
//// 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. |
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.
nit: :s/execpt/except/g
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.
PRS WELCOME RORY!
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.
If someone's going to address this typo, consider also mentioning the new try_reserve
in Permit
's rustdoc (currently it only mentions reserve
as returning it). I can submit that PR if nobody else is on it 😄
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.
Go ahead.
Add a
try_reserve
function to the mpscSender
. This allows to attempt to query theSender
for available send slots without having to materialize theT
value.