[][src]Struct flize::Shared

#[repr(transparent)]pub struct Shared<'shield, V, T1 = NullTag, T2 = NullTag> where
    V: 'shield,
    T1: Tag,
    T2: Tag
{ /* fields omitted */ }

A Shared represents a tagged pointer. It provides various utility methods for type conversion and tag manipulation. In addition it is the only pointer type that can be used to interact with Atomic since this type enforces a lifetime based on the shield used to create it.

Implementations

impl<'shield, V, T1, T2> Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

pub fn null() -> Self[src]

pub unsafe fn from_ptr(ptr: *mut V) -> Self[src]

Constructs a Shared from a raw tagged pointer with an arbitrary lifetime.

Safety

The alignment of V must free up sufficient low bits so that T fits.

pub unsafe fn from_raw(data: usize) -> Self[src]

Constructs a Shared from a raw tagged pointer represented as an integer with an arbitrary lifetime.

This function constructs a Shared<'shield, V, T> from a raw tagged pointer.

Safety

This is marked unsafe because extreme caution must be taken to supply correct data and ensure the lifetime is what you expect.

pub fn into_raw(self) -> usize[src]

Get the raw tagged pointer as an integer.

pub fn as_ptr(self) -> *mut V[src]

Get the raw tagged pointer.

pub fn strip(self) -> Self[src]

Remove all tags by zeroing their bits.

pub unsafe fn as_ref(self) -> Option<&'shield V>[src]

Converts the pointer into a reference. This will panic if the tagged pointer is null.

Safety

  • The pointer must either be null or point to a valid instance of V.
  • You must ensure the instance of V is not borrowed mutably.

pub unsafe fn as_mut_ref(self) -> Option<&'shield mut V>[src]

Converts the pointer into a mutable reference. This will panic if the tagged pointer is null.

Safety

  • The pointer must either be null or point to a valid instance of V.
  • You must ensure the instance of V is not borrowed.

pub unsafe fn as_ref_unchecked(self) -> &'shield V[src]

Converts the pointer into a reference.

Safety

  • The pointer must point to a valid instance of V.
  • You must ensure the instance of V is not borrowed mutably.

pub unsafe fn as_mut_ref_unchecked(self) -> &'shield mut V[src]

Converts the pointer into a mutable reference.

Safety

  • The pointer must point to a valid instance of V.
  • You must ensure the instance of V is not borrowed.

pub fn is_null(self) -> bool[src]

Check if the tagged pointer is null.

pub fn tag_lo(self) -> T1[src]

Get the tag in the low position.

pub fn tag_hi(self) -> T2[src]

Get the tag in the high position.

pub fn with_tag_lo(self, tag: T1) -> Self[src]

Set the tag in the low position.

pub fn with_tag_hi(self, tag: T2) -> Self[src]

Set the tag in the high position.

Trait Implementations

impl<'shield, V, T1, T2> Clone for Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

impl<'shield, V, T1, T2> Copy for Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

impl<'shield, V, T1, T2> Debug for Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

impl<'shield, V, T1, T2> Eq for Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

impl<'shield, V, T1, T2> PartialEq<Shared<'shield, V, T1, T2>> for Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

impl<'shield, V, T1, T2> Send for Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

impl<'shield, V, T1, T2> Sync for Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

impl<'shield, V, T1, T2> Unpin for Shared<'shield, V, T1, T2> where
    V: 'shield,
    T1: Tag,
    T2: Tag
[src]

Auto Trait Implementations

impl<'shield, V, T1, T2> RefUnwindSafe for Shared<'shield, V, T1, T2> where
    T1: RefUnwindSafe,
    T2: RefUnwindSafe,
    V: RefUnwindSafe

impl<'shield, V, T1, T2> UnwindSafe for Shared<'shield, V, T1, T2> where
    T1: UnwindSafe,
    T2: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.