rstd 0.1.0
Loading...
Searching...
No Matches
rstd::mem::manually_drop::ManuallyDrop< T > Class Template Referenceexport
module rstd.core

A wrapper that inhibits the automatic destructor call, analogous to Rust's ManuallyDrop<T>. More...

Public Member Functions

constexpr auto as_ptr () const -> T const *
 Returns a const pointer to the contained value.
 
constexpr auto as_mut_ptr () -> T *
 Returns a mutable pointer to the contained value.
 
constexpr auto take () -> T &&
 Extracts the contained value by move.
 

Static Public Member Functions

static constexpr auto make (T &&v) noexcept -> ManuallyDrop
 Creates a new ManuallyDrop wrapping the given value.
 

Detailed Description

template<typename T = void>
class rstd::mem::manually_drop::ManuallyDrop< T >

A wrapper that inhibits the automatic destructor call, analogous to Rust's ManuallyDrop<T>.

The contained value will not be dropped when ManuallyDrop goes out of scope. Use ManuallyDrop<void>::drop() to explicitly destroy the inner value.

Template Parameters
TThe wrapped type; defaults to void for the factory/drop helper specialization.

Member Function Documentation

◆ make()

template<typename T = void>
static constexpr auto rstd::mem::manually_drop::ManuallyDrop< T >::make ( T && v) -> ManuallyDrop
inlinestaticnodiscardconstexprexportnoexcept

Creates a new ManuallyDrop wrapping the given value.

Parameters
vThe value to wrap.
Returns
A ManuallyDrop containing the moved value.

The documentation for this class was generated from the following file: