[][src]Struct swim_mem::lease::Mut

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

A thread-safe, atomically counted, mutably dereferenceable hard reference to a Resident occupying a shared, Hold-allocated memory block.

Methods

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

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

pub fn try_hold_clone_meta<T: ?Sized, M>(
    hold: &dyn Hold<'a>,
    data: &T,
    meta: M
) -> Result<Mut<'a, R>, HoldError> where
    R: ResidentFromClone<Mut<'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<Mut<'a, R>, HoldError> where
    R: ResidentFromCloneUnchecked<Mut<'a, R>, T, M>, 
[src]

pub fn try_hold_copy_meta<T: ?Sized, M>(
    hold: &dyn Hold<'a>,
    data: &T,
    meta: M
) -> Result<Mut<'a, R>, HoldError> where
    R: ResidentFromCopy<Mut<'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<Mut<'a, R>, HoldError> where
    R: ResidentFromCopyUnchecked<Mut<'a, R>, T, M>, 
[src]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pub fn hard_count(this: &Mut<'a, R>) -> usize[src]

Returns the number of hard references to the shared resident.

pub fn soft_count(this: &Mut<'a, R>) -> usize[src]

Returns the number of soft references to the shared resident.

pub fn ref_count(this: &Mut<'a, R>) -> usize[src]

Returns the number of immutable references to the shared resident; always returns zero.

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

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

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

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

pub fn try_into_ref(this: Mut<'a, R>) -> Result<Ref<'a, R>, ArcError>[src]

Converts this mutable lease into an immutable lease to the shared resident, returning an error if the incremented reference count overflows REF_COUNT_MAX.

pub fn into_ref(this: Mut<'a, R>) -> Ref<'a, R>[src]

Converts this mutable lease into an immutable lease to the shared resident.

Panics

Panics if the incremented reference count overflows REF_COUNT_MAX.

pub unsafe fn try_to_hard(this: &Mut<'a, R>) -> Result<Hard<'a, R>, ArcError>[src]

Returns a new hard reference to the shared resident, returning an error if the incremented hard reference count overflows HARD_COUNT_MAX.

Safety

Mutable leases can coexist with hard and soft leases to the same resident. This can cause a future deadlock if a thread holding a mutable lease to a resident attempts to convert another hard or soft lease to the same resident into a mutable or immutable lease.

pub unsafe fn to_hard(this: &Mut<'a, R>) -> Hard<'a, R>[src]

Returns a new hard reference to the shared resident.

Safety

Mutable leases can coexist with hard and soft leases to the same resident. This can cause a future deadlock if a thread holding a mutable lease to a resident attempts to convert another hard or soft lease to the same resident into a mutable or immutable lease.

Panics

Panics if the incremented hard reference count overflows HARD_COUNT_MAX.

pub fn into_hard(this: Mut<'a, R>) -> Hard<'a, R>[src]

Converts this mutable lease into a hard lease.

pub unsafe fn try_to_soft(this: &Mut<'a, R>) -> Result<Soft<'a, R>, ArcError>[src]

Returns a new soft reference to the shared resident, returning an error if the incremented soft reference count overflows SOFT_COUNT_MAX.

Safety

Mutable leases can coexist with hard and soft leases to the same resident. This can cause a future deadlock if a thread holding a mutable lease to a resident attempts to convert another hard or soft lease to the same resident into a mutable or immutable lease.

pub unsafe fn to_soft(this: &Mut<'a, R>) -> Soft<'a, R>[src]

Returns a new soft reference to the shared resident.

Safety

Mutable leases can coexist with hard and soft leases to the same resident. This can cause a future deadlock if a thread holding a mutable lease to a resident attempts to convert another hard or soft lease to the same resident into a mutable or immutable lease.

Panics

Panics if the incremented soft reference count overflows SOFT_COUNT_MAX.

pub fn try_into_soft(this: Mut<'a, R>) -> Result<Soft<'a, R>, ArcError>[src]

Converts this mutable lease into a soft lease to the shared resident, returning an error if the incremented soft reference count overflows SOFT_COUNT_MAX.

pub fn into_soft(this: Mut<'a, R>) -> Soft<'a, R>[src]

Converts this mutable lease into a soft lease to the shared resident.

Panics

Panics if the incremented soft reference count overflows SOFT_COUNT_MAX.

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

Converts this mutable lease into a raw pointer to the shared resident. Use Mut::from_raw to reconstitute the returned pointer back into a mutable lease.

Safety

A memory leak will occur unless the returned pointer is eventually converted back into a mutable lease and dropped.

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

Returns a raw pointer to the shared resident.

Safety

The shared resident may be uninitialized.

pub fn try_unwrap(this: Mut<'a, R>) -> Result<R::Target, Mut<'a, R>> where
    R: ResidentUnwrap<Mut<'a, R>>, 
[src]

Consumes this mutable lease, and returns the shared resident; returns an Err containing the original lease if any outstanding hard leases prevent the resident from being moved.

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

Consumes this mutable lease, and returns the shared resident.

Panics

Panics if any outstanding hard leases prevent the resident from being moved.

Trait Implementations

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

impl<'a, R: Resident> Lease for Mut<'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 Mut<'a, R>[src]

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

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

impl<'a, R: ResidentOrd<Mut<'a, R>>> Ord for Mut<'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<Mut<'a, R>, T>, T: ?Sized> PartialOrd<T> for Mut<'a, R>[src]

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

type Target = R::Target

The resulting type after dereferencing.

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

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

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

type Output = R::Output

The resulting type after applying the + operator.

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

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

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

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

type Output = R::Output

The returned type after indexing.

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

impl<'a, R: ResidentHash<Mut<'a, R>>> Hash for Mut<'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 Mut<'a, R> where
    R::Data: Sync,
    R::Meta: Sync
[src]

impl<'a, R: ResidentIntoIterator<Mut<'a, R>>> IntoIterator for Mut<'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, Mut<'a, R>>> IntoIterator for &'a Mut<'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, Mut<'a, R>>> IntoIterator for &'a mut Mut<'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 Mut<'a, R> where
    R::Data: Send,
    R::Meta: Send
[src]

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

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

impl<'a, R: ResidentAsRef<Mut<'a, R>, T>, T: ?Sized> AsRef<T> for Mut<'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]