Created
June 12, 2017 23:43
-
-
Save anonymous/5ac481c67e095798da72c3f561b3ebd5 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains hidden or 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 MyStruct<'a> { | |
stuffs: Vec<&'a AnotherStruct> | |
} | |
pub struct AnotherStruct { | |
some_data: DataStruct | |
} | |
pub struct DataStruct { | |
number: i32, | |
another_number: i32, | |
yet_another_number: i32, | |
is_cool: bool | |
} | |
impl<'a> MyStruct<'a> { | |
pub fn do_something(&self, data: DataStruct) { | |
for stuff in &self.stuffs { | |
if stuff.some_data.is_cool == data.is_cool{ | |
stuff.some_data = data; | |
break; | |
} | |
} | |
} | |
} | |
fn main(){ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment