Created
July 19, 2019 10:01
-
-
Save rust-play/4b6fd10d5a9335c50208ef2c60e4c718 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Cat { | |
weight: i32, | |
} | |
trait Animal { | |
type Weight; | |
fn get_weight(&self) -> &Self::Weight; | |
} | |
impl Animal for Cat { | |
type Weight = 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