[−][src]Struct flize::Shared
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]
V: 'shield,
T1: Tag,
T2: Tag,
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]
V: 'shield,
T1: Tag,
T2: Tag,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'shield, V, T1, T2> Copy for Shared<'shield, V, T1, T2> where
V: 'shield,
T1: Tag,
T2: Tag,
[src]
V: 'shield,
T1: Tag,
T2: Tag,
impl<'shield, V, T1, T2> Debug for Shared<'shield, V, T1, T2> where
V: 'shield,
T1: Tag,
T2: Tag,
[src]
V: 'shield,
T1: Tag,
T2: Tag,
impl<'shield, V, T1, T2> Eq for Shared<'shield, V, T1, T2> where
V: 'shield,
T1: Tag,
T2: Tag,
[src]
V: 'shield,
T1: Tag,
T2: Tag,
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]
V: 'shield,
T1: Tag,
T2: Tag,
impl<'shield, V, T1, T2> Send for Shared<'shield, V, T1, T2> where
V: 'shield,
T1: Tag,
T2: Tag,
[src]
V: 'shield,
T1: Tag,
T2: Tag,
impl<'shield, V, T1, T2> Sync for Shared<'shield, V, T1, T2> where
V: 'shield,
T1: Tag,
T2: Tag,
[src]
V: 'shield,
T1: Tag,
T2: Tag,
impl<'shield, V, T1, T2> Unpin for Shared<'shield, V, T1, T2> where
V: 'shield,
T1: Tag,
T2: Tag,
[src]
V: 'shield,
T1: Tag,
T2: Tag,
Auto Trait Implementations
impl<'shield, V, T1, T2> RefUnwindSafe for Shared<'shield, V, T1, T2> where
T1: RefUnwindSafe,
T2: RefUnwindSafe,
V: RefUnwindSafe,
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,
T1: UnwindSafe,
T2: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,