Struct dispose::Disposable[][src]

pub struct Disposable<T: Dispose>(_);
Expand description

Wrapper for values implementing Dispose that provides a Drop implementation.

This struct will automatically consume its contents on drop using the provided Dispose implementation.

See this page for example usage.

Implementations

Construct a new Disposable instance, wrapping around val.

Consume the wrapper, producing the contained value.

Safety

It is up to the user to ensure the value does not fall out of scope without being consumed.

The value can be safely re-inserted into a Disposable using Disposable::new to restore safe drop behavior, and it is recommended that the value is held by some container which consumes it on drop at all times. The intended use case for this function is transferring the value from one container to the other.

Trait Implementations

Performs the conversion.

Performs the conversion.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Executes the destructor for this type. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.