Crate takeable [] [src]

Crate for temporarily moving out of a mutable pointer.

This crate implementation a single wrapper-type Takeable<T>. The main purpose of this wrapper is that it provides two convenient helper function borrow and borrow_result that allows for temporarily moving out of the wrapper without violating safety.

These work similarly to take from the take_mut crate. The main difference is that while the take_mut is implemented using careful handling of unwind safety, this crate using an Option<T> inside to make unwinding work as expected.

To do so effeciently, it uses the UncheckedOptionExt trait from the unreachable crate. This behavior can be turned off by disabling the microoptimizations feature. Option at a lower performance cost.

Structs

Takeable

A wrapper-type that always hold a single T value.