use refuse::{CollectionGuard, MapAs, Ref, Root, Trace};
#[derive(Trace, MapAs)]
struct Error {
message: Ref<String>,
}
fn main() {
let mut guard = CollectionGuard::acquire();
let message = Ref::new(String::from("Hello!"), &guard);
let error = Root::new(Error { message }, &guard);
guard.collect();
assert_eq!(message.load(&guard).expect("still alive"), "Hello!");
drop(error);
guard.collect();
assert_eq!(message.load(&guard), None);
}