astd::convert

Trait Take

source
pub trait Take<T>
where T: Sized,
{ // Required method unsafe fn take(self) -> T; }
Expand description

Simple and safe ownership acquisition of sub-elements of a type.

Any caller of this trait that acquires the underlying element must abide by the underlying requirements of that type for resource destruction.

Required Methods§

source

unsafe fn take(self) -> T

Takes ownership of the underlying T element that is a sub-resource of this type.

§Safety

The caller of this function must ensure that they take responsibility of the underlying T element if ownership is safely acquired. This may require manually dropping or destroying the underlying resource in a safe way.

Implementors§