Created
July 21, 2015 06:26
-
-
Save mfpiccolo/8bd0e1f2c65ee50e2e59 to your computer and use it in GitHub Desktop.
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
pub struct TwoNumbers { | |
first: i32, | |
second: i32, | |
} | |
impl TwoNumbers { | |
fn plus_one_to_each(self) -> TwoNumbers { | |
let mut tn = self; | |
tn.first += 1; | |
tn.second += 1; | |
tn | |
} | |
} | |
#[no_mangle] | |
pub extern fn add_one_to_vals(numbers: TwoNumbers) -> TwoNumbers { | |
numbers.plus_one_to_each() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment