Skip to content

Commit

Permalink
Explicitly explain what token bucket is an example of
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn committed Oct 5, 2023
1 parent 98f308e commit fd448eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tokio/src/sync/semaphore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ use std::sync::Arc;
///
/// ## Rate limiting using a token bucket
///
/// This example showcases the [`add_permits`] and [`SemaphorePermit::forget`] methods.
///
/// Many applications and systems have constraints on the rate at which certain
/// operations should occur. Exceeding this rate can result in suboptimal
/// performance or even errors.
Expand All @@ -261,6 +263,8 @@ use std::sync::Arc;
/// lot of cpu constantly looping and sleeping.
///
/// [token bucket]: https://en.wikipedia.org/wiki/Token_bucket
/// [`add_permits`]: crate::sync::Semaphore::add_permits
/// [`SemaphorePermit::forget`]: crate::sync::SemaphorePermit::forget
/// ```
/// use std::sync::Arc;
/// use tokio::sync::Semaphore;
Expand Down

0 comments on commit fd448eb

Please sign in to comment.