Prelude

trait ToString {
  fn to_string(&self) -> String;
}

Static Dispatch

fn yell<S: ToString>(stringable: S) {
  println!(stringable.to_string().to_uppercase())
}

Dynamic Dispatch

fn yell(stringable: &dyn ToString) {
  println!(stringable.to_string().to_uppercase())
}

impl Trait

fn yell(stringable: impl ToString) {
  println!(stringable.to_string().to_uppercase())
}