[][src]Struct swim_mem::lease::Ptr

pub struct Ptr<'a, R: Resident> { /* fields omitted */ }

An exclusive reference to a Resident occupying an owned, Hold-allocated memory block, with resident metadata stored within the allocation.

Methods

impl<'a, R: Resident> Ptr<'a, R>[src]

pub fn try_hold_new_meta<T, M>(
    hold: &dyn Hold<'a>,
    data: T,
    meta: M
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromValue<Ptr<'a, R>, T, M>, 
[src]

pub fn try_hold_clone_meta<T: ?Sized, M>(
    hold: &dyn Hold<'a>,
    data: &T,
    meta: M
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromClone<Ptr<'a, R>, T, M>, 
[src]

pub unsafe fn try_hold_clone_unchecked_meta<T: ?Sized, M>(
    hold: &dyn Hold<'a>,
    data: &T,
    meta: M
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromCloneUnchecked<Ptr<'a, R>, T, M>, 
[src]

pub fn try_hold_copy_meta<T: ?Sized, M>(
    hold: &dyn Hold<'a>,
    data: &T,
    meta: M
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromCopy<Ptr<'a, R>, T, M>, 
[src]

pub unsafe fn try_hold_copy_unchecked_meta<T: ?Sized, M>(
    hold: &dyn Hold<'a>,
    data: &T,
    meta: M
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromCopyUnchecked<Ptr<'a, R>, T, M>, 
[src]

pub fn try_hold_empty_meta<M>(
    hold: &dyn Hold<'a>,
    meta: M
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromEmpty<Ptr<'a, R>, M>, 
[src]

pub fn try_hold_cap_meta<M>(
    hold: &dyn Hold<'a>,
    cap: usize,
    meta: M
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentWithCapacity<Ptr<'a, R>, M>, 
[src]

pub fn try_hold_new<T>(
    hold: &dyn Hold<'a>,
    data: T
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromValue<Ptr<'a, R>, T>, 
[src]

pub fn try_hold_clone<T: ?Sized>(
    hold: &dyn Hold<'a>,
    data: &T
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromClone<Ptr<'a, R>, T>, 
[src]

pub unsafe fn try_hold_clone_unchecked<T: ?Sized>(
    hold: &dyn Hold<'a>,
    data: &T
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromCloneUnchecked<Ptr<'a, R>, T>, 
[src]

pub fn try_hold_copy<T: ?Sized>(
    hold: &dyn Hold<'a>,
    data: &T
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromCopy<Ptr<'a, R>, T>, 
[src]

pub unsafe fn try_hold_copy_unchecked<T: ?Sized>(
    hold: &dyn Hold<'a>,
    data: &T
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromCopyUnchecked<Ptr<'a, R>, T>, 
[src]

pub fn try_hold_empty(hold: &dyn Hold<'a>) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentFromEmpty<Ptr<'a, R>>, 
[src]

pub fn try_hold_cap(
    hold: &dyn Hold<'a>,
    cap: usize
) -> Result<Ptr<'a, R>, HoldError> where
    R: ResidentWithCapacity<Ptr<'a, R>>, 
[src]

pub fn hold_new<T>(hold: &dyn Hold<'a>, data: T) -> Ptr<'a, R> where
    R: ResidentFromValue<Ptr<'a, R>, T>, 
[src]

pub fn hold_clone<T: ?Sized>(hold: &dyn Hold<'a>, data: &T) -> Ptr<'a, R> where
    R: ResidentFromClone<Ptr<'a, R>, T>, 
[src]

pub unsafe fn hold_clone_unchecked<T: ?Sized>(
    hold: &dyn Hold<'a>,
    data: &T
) -> Ptr<'a, R> where
    R: ResidentFromCloneUnchecked<Ptr<'a, R>, T>, 
[src]

pub fn hold_copy<T: ?Sized>(hold: &dyn Hold<'a>, data: &T) -> Ptr<'a, R> where
    R: ResidentFromCopy<Ptr<'a, R>, T>, 
[src]

pub unsafe fn hold_copy_unchecked<T: ?Sized>(
    hold: &dyn Hold<'a>,
    data: &T
) -> Ptr<'a, R> where
    R: ResidentFromCopyUnchecked<Ptr<'a, R>, T>, 
[src]

pub fn hold_empty(hold: &dyn Hold<'a>) -> Ptr<'a, R> where
    R: ResidentFromEmpty<Ptr<'a, R>>, 
[src]

pub fn hold_cap(hold: &dyn Hold<'a>, cap: usize) -> Ptr<'a, R> where
    R: ResidentWithCapacity<Ptr<'a, R>>, 
[src]

pub fn new<T>(data: T) -> Ptr<'a, R> where
    R: ResidentFromValue<Ptr<'a, R>, T>, 
[src]

pub fn from_clone<T: ?Sized>(data: &T) -> Ptr<'a, R> where
    R: ResidentFromClone<Ptr<'a, R>, T>, 
[src]

pub unsafe fn from_clone_unchecked<T: ?Sized>(data: &T) -> Ptr<'a, R> where
    R: ResidentFromCloneUnchecked<Ptr<'a, R>, T>, 
[src]

pub fn from_copy<T: ?Sized>(data: &T) -> Ptr<'a, R> where
    R: ResidentFromCopy<Ptr<'a, R>, T>, 
[src]

pub unsafe fn from_copy_unchecked<T: ?Sized>(data: &T) -> Ptr<'a, R> where
    R: ResidentFromCopyUnchecked<Ptr<'a, R>, T>, 
[src]

pub fn empty() -> Ptr<'a, R> where
    R: ResidentFromEmpty<Ptr<'a, R>>, 
[src]

pub fn with_cap(cap: usize) -> Ptr<'a, R> where
    R: ResidentWithCapacity<Ptr<'a, R>>, 
[src]

pub unsafe fn from_raw(data: *mut R::Data) -> Ptr<'a, R>[src]

Constructs a Ptr lease from a raw pointer returned by Ptr::into_raw.

pub fn metadata<'b>(this: &'b Ptr<'a, R>) -> &'b R::Meta[src]

Returns a reference to the user-provided metadata associated with the owned resident.

pub fn metadata_mut<'b>(this: &'b mut Ptr<'a, R>) -> &'b mut R::Meta[src]

Returns a mutable reference to the user-provided metadata associated with the owned resident.

pub unsafe fn into_raw(this: Ptr<'a, R>) -> *mut R::Data[src]

Converts this Ptr lease into a raw pointer to the owned resident. Use Ptr::from_raw to reconstitute the returned pointer back into a Ptr lease.

Safety

A memory leak will occur unless the returned pointer is eventually converted back into an Ptr lease, with the same metadata type, and dropped.

pub fn unwrap(this: Ptr<'a, R>) -> R::Target where
    R: ResidentUnwrap<Ptr<'a, R>>, 
[src]

Consumes this Ptr lease, and returns the owned resident.

Trait Implementations

impl<'a, R: Resident> Holder<'a> for Ptr<'a, R>[src]

impl<'a, 'b, R: ResidentStow<'b, Ptr<'a, R>, Ptr<'b, R>>> StowFrom<'b, Ptr<'a, R>> for Ptr<'b, R>[src]

fn stow_from(value: T, hold: &dyn Hold<'b>) -> Self[src]

impl<'a, 'b, R: ResidentStow<'b, Ptr<'a, R>, Ptr<'b, R>>> Stow<'b, Ptr<'b, R>> for Ptr<'a, R>[src]

impl<'a, R: ResidentClone<Ptr<'a, R>, Ptr<'a, R>>> TryClone for Ptr<'a, R>[src]

impl<'a, 'b, R: ResidentClone<Ptr<'b, R>, Ptr<'a, R>>> CloneIntoHold<'a, Ptr<'a, R>> for Ptr<'b, R>[src]

fn clone_into_hold(&self, hold: &dyn Hold<'a>) -> T[src]

Returns a clone of self allocated in hold. Read more

impl<'a, R: Resident> Lease for Ptr<'a, R>[src]

type Data = R::Data

The type of pointed-to data stored in leased memory blocks. The size of leased memory blocks must be a positive multiple of the Data size. Read more

type Meta = R::Meta

The type of metadata stored with leased memory blocks. Meta data must contain sufficient information to resolve the size of any resided-in memory Lease. Read more

impl<'a, R: Resident> DynamicLease<'a> for Ptr<'a, R>[src]

impl<'a, R: ResidentPartialEq<Ptr<'a, R>, T>, T: ?Sized> PartialEq<T> for Ptr<'a, R>[src]

impl<'a, R: ResidentEq<Ptr<'a, R>>> Eq for Ptr<'a, R>[src]

impl<'a, R: ResidentOrd<Ptr<'a, R>>> Ord for Ptr<'a, R>[src]

default fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

default fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

default fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<'a, R: ResidentPartialOrd<Ptr<'a, R>, T>, T: ?Sized> PartialOrd<T> for Ptr<'a, R>[src]

impl<'a, R: ResidentDeref<Ptr<'a, R>>> Deref for Ptr<'a, R>[src]

type Target = R::Target

The resulting type after dereferencing.

impl<'a, R: ResidentDisplay<Ptr<'a, R>>> Display for Ptr<'a, R>[src]

impl<'a, R: ResidentDebug<Ptr<'a, R>>> Debug for Ptr<'a, R>[src]

impl<'a, R: ResidentAdd<Ptr<'a, R>, Rhs>, Rhs> Add<Rhs> for Ptr<'a, R>[src]

type Output = R::Output

The resulting type after applying the + operator.

impl<'a, R: ResidentAddAssign<Ptr<'a, R>, Rhs>, Rhs> AddAssign<Rhs> for Ptr<'a, R>[src]

impl<'a, R: ResidentDerefMut<Ptr<'a, R>>> DerefMut for Ptr<'a, R>[src]

impl<'a, R: Resident> Drop for Ptr<'a, R>[src]

impl<'a, R: ResidentIndex<Ptr<'a, R>, Idx>, Idx> Index<Idx> for Ptr<'a, R>[src]

type Output = R::Output

The returned type after indexing.

impl<'a, R: ResidentIndexMut<Ptr<'a, R>, Idx>, Idx> IndexMut<Idx> for Ptr<'a, R>[src]

impl<'a, R: ResidentHash<Ptr<'a, R>>> Hash for Ptr<'a, R>[src]

default fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<'a, R: Resident> Sync for Ptr<'a, R> where
    R::Data: Sync,
    R::Meta: Sync
[src]

impl<'a, R: ResidentIntoIterator<Ptr<'a, R>>> IntoIterator for Ptr<'a, R>[src]

type Item = R::Item

The type of the elements being iterated over.

type IntoIter = R::IntoIter

Which kind of iterator are we turning this into?

impl<'a, R: ResidentIntoRefIterator<'a, Ptr<'a, R>>> IntoIterator for &'a Ptr<'a, R>[src]

type Item = R::Item

The type of the elements being iterated over.

type IntoIter = R::IntoIter

Which kind of iterator are we turning this into?

impl<'a, R: ResidentIntoMutIterator<'a, Ptr<'a, R>>> IntoIterator for &'a mut Ptr<'a, R>[src]

type Item = R::Item

The type of the elements being iterated over.

type IntoIter = R::IntoIter

Which kind of iterator are we turning this into?

impl<'a, R: Resident> Send for Ptr<'a, R> where
    R::Data: Send,
    R::Meta: Send
[src]

impl<'a, R: Resident> Pointer for Ptr<'a, R>[src]

impl<'a, R: ResidentClone<Ptr<'a, R>, Ptr<'a, R>>> Clone for Ptr<'a, R>[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a, R: ResidentAsMut<Ptr<'a, R>, T>, T: ?Sized> AsMut<T> for Ptr<'a, R>[src]

impl<'a, R: ResidentAsRef<Ptr<'a, R>, T>, T: ?Sized> AsRef<T> for Ptr<'a, R>[src]

Blanket Implementations

impl<T> From for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]