Struct crossbeam::epoch::Owned [−][src]
Expand description
An owned heap-allocated object.
This type is very similar to Box<T>
.
The pointer must be properly aligned. Since it is aligned, a tag can be stored into the unused least significant bits of the address.
Implementations
impl<T> Owned<T>
[src]
impl<T> Owned<T>
[src]pub unsafe fn from_raw(raw: *mut T) -> Owned<T>
[src]
pub unsafe fn from_raw(raw: *mut T) -> Owned<T>
[src]Returns a new owned pointer pointing to raw
.
This function is unsafe because improper use may lead to memory problems. Argument raw
must be a valid pointer. Also, a double-free may occur if the function is called twice on
the same raw pointer.
Panics
Panics if raw
is not properly aligned.
Safety
The given raw
should have been derived from Owned
, and one raw
should not be converted
back by Owned::from_raw()
multiple times.
Examples
use crossbeam_epoch::Owned; let o = unsafe { Owned::from_raw(Box::into_raw(Box::new(1234))) };
impl<T> Owned<T> where
T: Pointable + ?Sized,
[src]
impl<T> Owned<T> where
T: Pointable + ?Sized,
[src]pub fn init(init: <T as Pointable>::Init) -> Owned<T>
[src]
pub fn init(init: <T as Pointable>::Init) -> Owned<T>
[src]Allocates value
on the heap and returns a new owned pointer pointing to it.
Examples
use crossbeam_epoch::Owned; let o = Owned::<i32>::init(1234);
pub fn into_shared(self, &'g Guard) -> Shared<'g, T>
[src]
pub fn into_shared(self, &'g Guard) -> Shared<'g, T>
[src]Trait Implementations
impl<T> BorrowMut<T> for Owned<T> where
T: Pointable + ?Sized,
[src]
impl<T> BorrowMut<T> for Owned<T> where
T: Pointable + ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointer<T> for Owned<T> where
T: Pointable + ?Sized,
[src]
impl<T> Pointer<T> for Owned<T> where
T: Pointable + ?Sized,
[src]pub unsafe fn from_usize(data: usize) -> Owned<T>
[src]
pub unsafe fn from_usize(data: usize) -> Owned<T>
[src]Returns a new pointer pointing to the tagged pointer data
.
Panics
Panics if the data is zero in debug mode.
pub fn into_usize(self) -> usize
[src]
pub fn into_usize(self) -> usize
[src]Returns the machine representation of the pointer.
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for Owned<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized> Send for Owned<T> where
T: Send,
T: Send,
impl<T: ?Sized> Sync for Owned<T> where
T: Sync,
T: Sync,
impl<T: ?Sized> Unpin for Owned<T>
impl<T: ?Sized> UnwindSafe for Owned<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
[src]
impl<T> Pointable for T
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more