Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created July 19, 2019 09:58
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/673716130a4360a0f3bd39ca5599d164 to your computer and use it in GitHub Desktop.
Save rust-play/673716130a4360a0f3bd39ca5599d164 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
struct Cat {
weight: i32,
}
trait Animal {
type T;
fn get_weight(&self) -> &Self::T;
}
impl Animal for Cat {
type T = i32;
fn get_weight(&self) -> &i32 {
&self.weight
}
}
fn main() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment