Document the DropBomb
This commit is contained in:
parent
08990b2f6d
commit
da59112e86
@ -1,6 +1,12 @@
|
||||
use crate::fmt::panic;
|
||||
use core::mem;
|
||||
|
||||
/// An explosive ordinance that panics if it is improperly disposed of.
|
||||
///
|
||||
/// This is to forbid dropping futures, when there is absolutely no other choice.
|
||||
///
|
||||
/// To correctly dispose of this device, call the [defuse](struct.DropBomb.html#method.defuse)
|
||||
/// method before this object is dropped.
|
||||
pub struct DropBomb {
|
||||
_private: (),
|
||||
}
|
||||
@ -9,7 +15,7 @@ impl DropBomb {
|
||||
pub fn new() -> Self {
|
||||
Self { _private: () }
|
||||
}
|
||||
|
||||
// Diffuses the bomb, rendering it safe to drop.
|
||||
pub fn defuse(self) {
|
||||
mem::forget(self)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user