Struct coco::epoch::Owned
[−]
[src]
pub struct Owned<T> { /* fields omitted */ }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.
Methods
impl<T> Owned<T>[src]
fn new(value: T) -> Self[src]
Allocates value on the heap and returns a new owned pointer pointing to it.
Examples
use coco::epoch::Owned; let o = Owned::new(1234);
fn from_box(b: Box<T>) -> Self[src]
Returns a new owned pointer initialized with b.
Panics
Panics if the pointer (the Box) is not properly aligned.
Examples
use coco::epoch::Owned; let o = unsafe { Owned::from_raw(Box::into_raw(Box::new(1234))) };
unsafe fn from_raw(raw: *mut T) -> Self[src]
Returns a new owned pointer initialized with raw.
Panics
Panics if raw is not properly aligned.
Examples
use coco::epoch::Owned; let o = unsafe { Owned::from_raw(Box::into_raw(Box::new(1234))) };
fn into_ptr<'scope>(self, _: &'scope Scope) -> Ptr<'scope, T>[src]
Converts the owned pointer to a Ptr.
Examples
use coco::epoch::{self, Owned}; let o = Owned::new(1234); epoch::pin(|scope| { let p = o.into_ptr(scope); });
fn tag(&self) -> usize[src]
Returns the tag stored within the pointer.
Examples
use coco::epoch::Owned; assert_eq!(Owned::new(1234).tag(), 0);
fn with_tag(self, tag: usize) -> Self[src]
Returns the same pointer, but tagged with tag.
Examples
use coco::epoch::Owned; let o = Owned::new(0u64); assert_eq!(o.tag(), 0); let o = o.with_tag(5); assert_eq!(o.tag(), 5);
Trait Implementations
impl<T: Debug> Debug for Owned<T>[src]
impl<T> Drop for Owned<T>[src]
impl<T> Deref for Owned<T>[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T[src]
Dereferences the value.