[−][src]Struct stdweb::DiscardOnDrop
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
.
Methods
impl<A: Discard> DiscardOnDrop<A>
[src]
pub fn new(discarder: A) -> Self
[src]
Creates a new DiscardOnDrop
.
When the DiscardOnDrop
is dropped it will automatically call discarder.discard()
.
pub fn leak(self) -> A
[src]
Returns the wrapped discarder
.
It will no longer automatically call discarder.discard()
, so this will usually leak
memory unless you manually call discarder.discard()
.
Trait Implementations
impl<A: Debug + Discard> Debug for DiscardOnDrop<A>
[src]
impl<A: Discard> Deref for DiscardOnDrop<A>
[src]
impl<A: Discard> DerefMut for DiscardOnDrop<A>
[src]
Auto Trait Implementations
impl<A> Send for DiscardOnDrop<A> where
A: Send,
A: Send,
impl<A> Sync for DiscardOnDrop<A> where
A: Sync,
A: Sync,
impl<A> Unpin for DiscardOnDrop<A> where
A: Unpin,
A: Unpin,
impl<A> UnwindSafe for DiscardOnDrop<A> where
A: UnwindSafe,
A: UnwindSafe,
impl<A> RefUnwindSafe for DiscardOnDrop<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,