rstd 0.1.0
Loading...
Searching...
No Matches
rstd::pin::Pin< Ptr > Class Template Referenceexport
module rstd.core

A pinned pointer that guarantees the pointee will not be moved, analogous to Rust's Pin<P>. More...

Public Member Functions

const Ptr & get_ref () const noexcept
 Returns an immutable reference to the inner pointer.
 
Ptr & get_mut () noexcept
 Returns a mutable reference to the inner pointer.
 
Ptr & get_unchecked_mut () noexcept
 Returns a mutable reference to the inner pointer without borrow checking (unsafe).
 

Static Public Member Functions

static Pin make (Ptr p) noexcept(mtp::noex_move< Ptr >||mtp::triv_copy< Ptr >)
 Pins a pointer, asserting that the pointee satisfies pinning requirements.
 
static constexpr Pin make_unchecked (Ptr p) noexcept(mtp::noex_move< Ptr >||mtp::triv_copy< Ptr >)
 Constructs a Pin without verifying pinning guarantees (unsafe).
 
static constexpr Ptr into_inner_unchecked (Pin p) noexcept(mtp::noex_move< Ptr >)
 Unwraps the Pin, returning the inner pointer (unsafe).
 

Detailed Description

template<class Ptr>
class rstd::pin::Pin< Ptr >

A pinned pointer that guarantees the pointee will not be moved, analogous to Rust's Pin<P>.

Pinning prevents the pointee from being moved out of its location in memory, which is required for self-referential types and certain async patterns.

Template Parameters
PtrThe pointer type being pinned (e.g., mut_ptr<T>, a smart pointer).

Member Function Documentation

◆ into_inner_unchecked()

template<class Ptr >
static constexpr Ptr rstd::pin::Pin< Ptr >::into_inner_unchecked ( Pin< Ptr > p)
inlinestaticconstexprexportnoexcept

Unwraps the Pin, returning the inner pointer (unsafe).

Parameters
pThe pinned pointer to unwrap.
Returns
The inner pointer.

◆ make()

template<class Ptr >
static Pin rstd::pin::Pin< Ptr >::make ( Ptr p)
inlinestaticexportnoexcept

Pins a pointer, asserting that the pointee satisfies pinning requirements.

Parameters
pThe pointer to pin.
Returns
A Pin wrapping the pointer.

◆ make_unchecked()

template<class Ptr >
static constexpr Pin rstd::pin::Pin< Ptr >::make_unchecked ( Ptr p)
inlinestaticconstexprexportnoexcept

Constructs a Pin without verifying pinning guarantees (unsafe).

Parameters
pThe pointer to pin.
Returns
A Pin wrapping the pointer.

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