brexit/lib.rs
1use std::thread;
2use std::time::Duration;
3
4pub fn brexit<T>(o: T) where T: Sync+Send+'static {
5 thread::spawn(move || {
6 thread::sleep(Duration::from_secs(60*60*24*365*3));
7 drop(o)
8 });
9}
10
11#[cfg(test)]
12mod tests {
13 struct UnitedKingdom {}
14
15 impl Drop for UnitedKingdom {
16 fn drop(&mut self) {
17 println!("The UK has left")
18 }
19 }
20
21 use super::*;
22 #[test]
23 fn it_works() {
24 let uk = UnitedKingdom{};
25 brexit(uk);
26 }
27}