pub struct DropToken { /* private fields */ }Expand description
A drop-checking token.
Created by DropCheck.
Trait Implementations§
Source§impl Clone for DropToken
Cloning a DropToken creates a fresh state, that’s still tied to the DropCheck set that
created the token. This means that leaking the cloned token is detected:
impl Clone for DropToken
Cloning a DropToken creates a fresh state, that’s still tied to the DropCheck set that
created the token. This means that leaking the cloned token is detected:
ⓘ
let dropcheck = DropCheck::new();
let token = dropcheck.token();
let cloned_token = token.clone();
std::mem::forget(cloned_token);
// panics when dropcheck is droppedSince the new token is part of the set it came from, it affects none_dropped/all_dropped:
let dropcheck = DropCheck::new();
let token = dropcheck.token();
let cloned_token = token.clone();
assert!(dropcheck.none_dropped());
drop(cloned_token);
assert!(!dropcheck.none_dropped());Auto Trait Implementations§
impl Freeze for DropToken
impl RefUnwindSafe for DropToken
impl Send for DropToken
impl Sync for DropToken
impl Unpin for DropToken
impl UnsafeUnpin for DropToken
impl UnwindSafe for DropToken
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more