Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created April 20, 2019 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/1da8c24402235f567a2b25162cdf1676 to your computer and use it in GitHub Desktop.
Save rust-play/1da8c24402235f567a2b25162cdf1676 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
pub trait Trait<T: std::fmt::Debug> {
fn display(&self, t: T) {
println!("{:?}", t);
}
}
pub struct Dummy;
impl<T: std::fmt::Debug> Trait<T> for Dummy{}
fn main() {
<Trait<i32>>::display(&Dummy, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment