#[must_use = "\n\n The DiscardOnDrop is unused, which causes it to be immediately discarded.\n You probably don\'t want that to happen.\n\n How to fix this:\n\n * Store the DiscardOnDrop in a variable or data structure.\n\n * Or use the leak() method which will cause it to not be\n discarded (this will usually leak memory!)\n\n See the documentation for more details.\n"]
pub struct DiscardOnDrop<A: Discard>(_);
If you have a value which implements Discard
, you can use
DiscardOnDrop::new(value)
which will wrap the value.
When the wrapper is dropped it will automatically call value.discard()
.
You can use the leak
method to unwrap it (which returns value
). This causes
it to no longer call discard
when it is dropped, which
means it will usually leak memory unless you manually call discard
.
Creates a new DiscardOnDrop
.
When the DiscardOnDrop
is dropped it will automatically call discarder.discard()
.
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Mutably dereferences the value.
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static