Skip to content

Instantly share code, notes, and snippets.

@jayhuang75
Last active March 30, 2022 15:12
Show Gist options
  • Select an option

  • Save jayhuang75/f5b3d6b524327f6cf5ab38e563f4ba08 to your computer and use it in GitHub Desktop.

Select an option

Save jayhuang75/f5b3d6b524327f6cf5ab38e563f4ba08 to your computer and use it in GitHub Desktop.
token_bucket_trait
pub trait Actions {
fn forward(&self, people: i64);
fn queue(&self, people: i64);
}
impl Actions for TokenBucket {
fn forward(&self, people: i64) {
println!("-> forward : {:?} people", people);
}
fn queue(&self, people: i64){
println!("<- queue : {:?} people", people);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment