[][src]Struct triomphe::Arc

#[repr(C)]
pub struct Arc<T: ?Sized> { /* fields omitted */ }

An atomically reference counted shared pointer

See the documentation for Arc in the standard library. Unlike the standard library Arc, this Arc does not support weak reference counting.

Methods

impl<T> Arc<T>[src]

pub fn new(data: T) -> Self[src]

Construct an Arc<T>

pub fn borrow_arc<'a>(&'a self) -> ArcBorrow<'a, T>[src]

Produce a pointer to the data that can be converted back to an Arc. This is basically an &Arc<T>, without the extra indirection. It has the benefits of an &T but also knows about the underlying refcount and can be converted into more Arc<T>s if necessary.

pub fn with_raw_offset_arc<F, U>(&self, f: F) -> U where
    F: FnOnce(&OffsetArc<T>) -> U, 
[src]

Temporarily converts |self| into a bonafide OffsetArc and exposes it to the provided callback. The refcount is not modified.

pub fn heap_ptr(&self) -> *const c_void[src]

Returns the address on the heap of the Arc itself -- not the T within it -- for memory reporting.

impl<T: ?Sized> Arc<T>[src]

pub fn ptr_eq(this: &Self, other: &Self) -> bool[src]

Test pointer equality between the two Arcs, i.e. they must be the same allocation

impl<T: Clone> Arc<T>[src]

pub fn make_mut(this: &mut Self) -> &mut T[src]

Makes a mutable reference to the Arc, cloning if necessary

This is functionally equivalent to Arc::make_mut from the standard library.

If this Arc is uniquely owned, make_mut() will provide a mutable reference to the contents. If not, make_mut() will create a new Arc with a copy of the contents, update this to point to it, and provide a mutable reference to its contents.

This is useful for implementing copy-on-write schemes where you wish to avoid copying things if your Arc is not shared.

impl<T: ?Sized> Arc<T>[src]

pub fn get_mut(this: &mut Self) -> Option<&mut T>[src]

Provides mutable access to the contents if the Arc is uniquely owned.

pub fn is_unique(&self) -> bool[src]

Whether or not the Arc is uniquely owned (is the refcount 1?)

impl<H, T> Arc<HeaderSlice<H, [T]>>[src]

pub fn from_header_and_iter<I>(header: H, items: I) -> Self where
    I: Iterator<Item = T> + ExactSizeIterator
[src]

Creates an Arc for a HeaderSlice using the given header struct and iterator to generate the slice. The resulting Arc will be fat.

impl<H, T> Arc<HeaderSlice<HeaderWithLength<H>, [T]>>[src]

pub fn into_thin(a: Self) -> ThinArc<H, T>[src]

Converts an Arc into a ThinArc. This consumes the Arc, so the refcount is not modified.

pub fn from_thin(a: ThinArc<H, T>) -> Self[src]

Converts a ThinArc into an Arc. This consumes the ThinArc, so the refcount is not modified.

impl<T> Arc<T>[src]

pub fn into_raw_offset(a: Self) -> OffsetArc<T>[src]

Converts an Arc into a OffsetArc. This consumes the Arc, so the refcount is not modified.

pub fn from_raw_offset(a: OffsetArc<T>) -> Self[src]

Converts a OffsetArc into an Arc. This consumes the OffsetArc, so the refcount is not modified.

Trait Implementations

impl<T: ?Sized> AsRef<T> for Arc<T>[src]

impl<T: Default> Default for Arc<T>[src]

impl<T: ?Sized + Sync + Send> Sync for Arc<T>[src]

impl<T: ?Sized> Clone for Arc<T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: ?Sized> Drop for Arc<T>[src]

impl<T: ?Sized + Ord> Ord for Arc<T>[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<T: ?Sized + Sync + Send> Send for Arc<T>[src]

impl<T> From<T> for Arc<T>[src]

impl<T: ?Sized + Eq> Eq for Arc<T>[src]

impl<T: ?Sized + PartialOrd> PartialOrd<Arc<T>> for Arc<T>[src]

impl<T: ?Sized + PartialEq> PartialEq<Arc<T>> for Arc<T>[src]

impl<T: ?Sized> Deref for Arc<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: ?Sized + Debug> Debug for Arc<T>[src]

impl<T: ?Sized + Display> Display for Arc<T>[src]

impl<T: ?Sized + Hash> Hash for Arc<T>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: ?Sized> Pointer for Arc<T>[src]

impl<T: ?Sized> Borrow<T> for Arc<T>[src]

impl<T: Serialize> Serialize for Arc<T>[src]

impl<'de, T: Deserialize<'de>> Deserialize<'de> for Arc<T>[src]

impl<T: ?Sized> StableDeref for Arc<T>[src]

impl<T: ?Sized> CloneStableDeref for Arc<T>[src]

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]