Skip to content

Instantly share code, notes, and snippets.

@MaikKlein
Created August 7, 2014 14:31
Show Gist options
  • Save MaikKlein/3576b342ed0ebbc806b7 to your computer and use it in GitHub Desktop.
Save MaikKlein/3576b342ed0ebbc806b7 to your computer and use it in GitHub Desktop.
struct Foo{
value: i32
}
impl Foo{
fn get_and_change_value(&mut self) -> i32{
let v = self.value;
self.value = 42;
v
}
}
//glue_code_macro
fn main(){
let mut f1 = Foo{value:1};
let mut f2 = Foo{value:2};
let mut f3 = Foo{value:3};
//let v: Vec<i32> = glue_code_macro!(f1,f2,f3);
let v1 = f1.get_and_change_value();
let v2 = f2.get_and_change_value();
let v3 = f3.get_and_change_value();
let v = [v1,v2,v3];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment