[][src]Struct swym::tptr::TPtr

pub struct TPtr<T> { /* fields omitted */ }

Experimental building block for recursive data structures.

This should be used in places to where single threaded data structures would have Option<NonNull<T>>/*mut T, and is similarly low level.

Methods

impl<T> TPtr<T>[src]

pub const fn new(ptr: *const T) -> Self[src]

Constructs a new TPtr from the provided pointer.

pub const fn null() -> Self[src]

Constructs a TPtr initialized to null.

pub fn into_inner(self) -> *const T[src]

Consumes the TPtr returning the underlying pointer.

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

Gets mutable access to the TPtr.

pub fn as_ptr<'tcell>(
    &'tcell self,
    tx: &impl Read<'tcell>,
    ordering: Ordering
) -> Result<*const T, Error>
[src]

Retrieve the contained pointer.

impl<T: Send + Sync + 'static> TPtr<T>[src]

pub fn publish_box<'tcell>(
    &'tcell self,
    tx: &mut impl Write<'tcell>,
    value: Box<T>
) -> Result<(), SetError<Box<T>>>
[src]

Publishes a new pointer from an owned Box.

Note

If the transaction fails at any later point, the memory is freed using Box::from_raw. No cleanup/deallocation of the previously contained pointer is performed.

pub fn publish<'tcell, F: FnOnce(*mut T) + Copy + 'static>(
    &'tcell self,
    tx: &mut impl Write<'tcell>,
    publisher: Publisher<T, F>
) -> Result<(), SetError<Publisher<T, F>>>
[src]

Publishes a new pointer.

Note

If the transaction fails at any later point, the desctructor with the pulisher is run. Publishing No cleanup/deallocation of the previously container pointer is performed.

pub unsafe fn privatize_as_box<'tcell>(
    tx: &mut impl Write<'tcell>,
    value: *const T
)
[src]

Queues up drop_in_place/deallocation of the raw pointer to happen at some later time, if and only if the transaction succeeds.

Safety

The raw pointer must have been previously allocated via Box::new, and not yet queued for privatization or deallocated via other means.

pub unsafe fn privatize<'tcell, F: FnOnce(*mut T) + Copy + Send + 'static>(
    tx: &mut impl Write<'tcell>,
    value: *const T,
    privatizer: F
)
[src]

Queues up a custom desctructor to happen at some later time, if and only if the transaction succeeds.

pub fn set<'tcell>(
    &'tcell self,
    tx: &mut impl Write<'tcell>,
    value: *const T
) -> Result<(), Error>
[src]

Sets the contained pointer.

Note

No cleanup/deallocation of the previously contained pointer is performed.

Trait Implementations

impl<T> Default for TPtr<T>[src]

Auto Trait Implementations

impl<T> Send for TPtr<T> where
    T: Send + Sync

impl<T> Sync for TPtr<T> where
    T: Send + Sync

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

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

The type returned in the event of a conversion error.

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

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

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

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

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

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

The type returned in the event of a conversion error.