Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created March 14, 2018 01:03
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/d0d62e94ccf80623fa81d9100e405b71 to your computer and use it in GitHub Desktop.
Save rust-play/d0d62e94ccf80623fa81d9100e405b71 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
use std::fmt::Display;
trait Bar<T: Display> {
fn foo(&self, s: T) {
println!("{}", s)
}
}
struct Foo;
impl<'a> Bar<&'a str> for Foo {}
fn main() {
let foo = Foo;
foo.foo("hi");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment