Skip to content

Instantly share code, notes, and snippets.

@lu-zero lu-zero/
Created Sep 30, 2019

What would you like to do?
use std::fmt;
struct Foo {
a: usize,
impl fmt::Display for Foo {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.a)
fn say_hello<T: fmt::Display>(who: T) {
println!("Hello {}", who);
fn main() {
let a = Foo { a: 42 };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.