Created
December 5, 2019 20:20
-
-
Save rust-play/68b57e15619bab6b751c78217d266498 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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
struct MyStruct<TCollection> | |
where | |
for<'a> &'a TCollection: IntoIterator<Item = &'a ()>, | |
{ | |
references: TCollection, | |
} | |
impl<TCollection> Drop for MyStruct<TCollection> | |
where | |
for<'b> &'b TCollection: IntoIterator<Item = &'b ()>, | |
{ | |
fn drop(&mut self) { | |
for _ in &self.references {} | |
} | |
} | |
fn main() { | |
let _ = MyStruct { | |
references: Vec::new(), | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment