Skip to content

Instantly share code, notes, and snippets.

@stivenson
Created July 1, 2019 02:54
Show Gist options
  • Save stivenson/c6d2b44aff607bd0cf26acc0f2eb73eb to your computer and use it in GitHub Desktop.
Save stivenson/c6d2b44aff607bd0cf26acc0f2eb73eb to your computer and use it in GitHub Desktop.

Revisions

  1. stivenson created this gist Jul 1, 2019.
    16 changes: 16 additions & 0 deletions new-trait-to-man-struct.rs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    // 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 ...
    }
    }