[−][src]Struct swym::tptr::TPtr
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]
&'tcell self,
tx: &impl Read<'tcell>,
ordering: Ordering
) -> Result<*const T, Error>
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]
&'tcell self,
tx: &mut impl Write<'tcell>,
value: Box<T>
) -> Result<(), SetError<Box<T>>>
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]
&'tcell self,
tx: &mut impl Write<'tcell>,
publisher: Publisher<T, F>
) -> Result<(), SetError<Publisher<T, F>>>
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]
tx: &mut impl Write<'tcell>,
value: *const T
)
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]
tx: &mut impl Write<'tcell>,
value: *const T,
privatizer: F
)
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]
&'tcell self,
tx: &mut impl Write<'tcell>,
value: *const T
) -> Result<(), Error>
Sets the contained pointer.
Note
No cleanup/deallocation of the previously contained pointer is performed.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,