2 releases
| 0.1.1 | Oct 6, 2020 |
|---|---|
| 0.1.0 | Sep 28, 2020 |
#654 in Memory management
7KB
112 lines
A Wrapper is a value which took ownership of some of the value, such that the wrapped value
can later be retrieved again. Conceptually this is identical to the regular Into trait, but
that trait is hard to implement because of conflicts with the reflexive blanket implementation.
Feature Flags
By default, this crate only provides implementations for types in core. The alloc feature
enables implementations for types in alloc, likewise std for std. Implementations for
unstable types are enabled with the unstable feature.
Wrapper
A Wrapper is a value which took ownership of some of the value, such that the wrapped value can later be retrieved again. Conceptually this is identical to the regular Into trait, but that trait is hard to implement because of conflicts with the reflexive blanket implementation.
/// A type that wraps a value of type `Inner` that can be retrieved via `into_inner`.
pub trait Wrapper<Inner> {
/// Retrieve ownership of the wrapped value.
fn into_inner(self) -> Inner;
}
Feature Flags
By default, this crate only provides implementations for types in core. The alloc feature enables implementations for types in alloc, likewise std for std. Implementations for unstable types are enabled with the unstable feature.
Dependencies
~8KB