pub fn drop<T>(_x: T)Expand description
Disposes of a value.
This does so by calling the argument’s implementation of Drop.
This effectively does nothing for types which implement Copy, e.g.
integers. Such values are copied and then moved into the function, so the
value persists after this function call.
This function is not magic; it is literally defined as
Because _x is moved into the function, it is automatically dropped before
the function returns.
§Examples
Basic usage:
Since RefCell enforces the borrow rules at runtime, drop can
release a RefCell borrow:
use std::cell::RefCell;
let x = RefCell::new(1);
let mut mutable_borrow = x.borrow_mut();
*mutable_borrow = 1;
drop(mutable_borrow); // relinquish the mutable borrow on this slot
let borrow = x.borrow();
println!("{}", *borrow);Integers and other types implementing Copy are unaffected by drop.