[][src]Struct coco::epoch::Ptr

pub struct Ptr<'p, T: 'p> { /* fields omitted */ }

A tagged nullable pointer.

Methods

impl<'p, T: 'p> Ptr<'p, T>[src]

pub fn null(tag: usize) -> Self[src]

Returns a null pointer with a tag.

Panics

Panics if the tag doesn't fit into the unused bits of an aligned pointer.

pub unsafe fn from_raw(raw: *mut T, tag: usize) -> Self[src]

Constructs a tagged pointer from a raw pointer and tag.

Panics

Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.

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

Returns true if the pointer is null.

pub fn as_ref(&self) -> Option<&'p T>[src]

Converts the pointer to a reference.

pub fn as_raw(&self) -> *mut T[src]

Converts the pointer to a raw pointer.

pub fn unwrap(&self) -> &'p T[src]

Returns a reference to the pointing object.

Panics

Panics if the pointer is null.

pub fn tag(&self) -> usize[src]

Returns the tag.

pub fn with_tag(&self, tag: usize) -> Self[src]

Constructs a new tagged pointer with a different tag.

Panics

Panics if the tag doesn't fit into the unused bits of the pointer.

Trait Implementations

impl<'a, T> Clone for Ptr<'a, T>[src]

impl<'a, T> Copy for Ptr<'a, T>[src]

impl<'p, T> Default for Ptr<'p, T>[src]

impl<'p, T: Debug + 'p> Debug for Ptr<'p, T>[src]

Auto Trait Implementations

impl<'p, T> !Send for Ptr<'p, T>

impl<'p, T> !Sync for Ptr<'p, T>

impl<'p, T> Unpin for Ptr<'p, T>

impl<'p, T> UnwindSafe for Ptr<'p, T> where
    T: RefUnwindSafe

impl<'p, T> RefUnwindSafe for Ptr<'p, T> where
    T: RefUnwindSafe

Blanket Implementations

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

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

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.

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

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

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