Created
July 1, 2019 02:54
-
-
Save stivenson/c6d2b44aff607bd0cf26acc0f2eb73eb to your computer and use it in GitHub Desktop.
Example of new trait to man struct
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
// other Code ... | |
trait Travel { | |
fn new(destination: &'static str) -> Self; | |
fn go(&self) -> &'static str; | |
} | |
impl Travel for Man { | |
fn new(destination: &'static str) -> Man { | |
// logic ... | |
} | |
fn go(&self) -> &'static str { | |
// logic ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment