Struct extra::arc::Arc

pub struct Arc<T> {
    priv x: std::unstable::sync::UnsafeArc,
}

Immutable Arc An atomically reference counted wrapper for shared immutable state.

Methods

impl<T: std::kinds::Freeze + std::kinds::Send> Arc<T>

fn new(data: T) -> Arc<T>

Create an atomically reference counted wrapper.

fn get<'a>(&'a self) -> &'a T

fn unwrap(self) -> T

Retrieve the data back out of the Arc. This function blocks until the reference given to it is the last existing one, and then unwrap the data instead of destroying it.

If multiple tasks call unwrap, all but the first will fail. Do not call unwrap from a task that holds another reference to the same Arc; it is guaranteed to deadlock.

Trait Implementations

impl<T: std::kinds::Freeze + std::kinds::Send> std::clone::Clone for Arc<T>

fn clone(&self) -> Arc<T>

Duplicate an atomically reference counted wrapper.

The resulting two arc objects will point to the same underlying data object. However, one of the arc objects can be sent to another task, allowing them to share the underlying data.