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]

Allocates value on the heap and returns a new owned pointer pointing to it.

Examples

use coco::epoch::Owned;

let o = Owned::new(1234);

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))) };

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))) };

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);
});

Returns the tag stored within the pointer.

Examples

use coco::epoch::Owned;

assert_eq!(Owned::new(1234).tag(), 0);

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]

Formats the value using the given formatter.

impl<T> Deref for Owned<T>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<T> DerefMut for Owned<T>
[src]

The method called to mutably dereference a value