Struct cstree::Arc [−][src]
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.
Implementations
impl<T> Arc<T>
[src]
pub fn new(data: T) -> Arc<T>
[src]
Construct an Arc<T>
pub fn into_raw(this: Arc<T>) -> *const T
[src]
Convert the Arc
Note: This returns a pointer to the data T, which is offset in the allocation.
It is recommended to use OffsetArc for this.
pub unsafe fn from_raw(ptr: *const T) -> Arc<T>
[src]
Reconstruct the Arc
Note: This raw pointer will be offset in the allocation and must be preceded by the atomic count.
It is recommended to use OffsetArc for this
pub fn borrow_arc(&'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]
F: FnOnce(&OffsetArc<T>) -> U,
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.
pub fn into_raw_offset(a: Arc<T>) -> 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>) -> Arc<T>
[src]
Converts a OffsetArc
into an Arc
. This consumes the OffsetArc
, so the refcount
is not modified.
impl<T> Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
pub fn ptr_eq(this: &Arc<T>, other: &Arc<T>) -> bool
[src]
Test pointer equality between the two Arcs, i.e. they must be the same allocation
impl<T> Arc<T> where
T: Clone,
[src]
T: Clone,
pub fn make_mut(this: &mut Arc<T>) -> &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> Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
pub fn get_mut(this: &mut Arc<T>) -> 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) -> Arc<HeaderSlice<H, [T]>> where
I: Iterator<Item = T> + ExactSizeIterator,
[src]
I: Iterator<Item = T> + ExactSizeIterator,
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: Arc<HeaderSlice<HeaderWithLength<H>, [T]>>) -> 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>) -> Arc<HeaderSlice<HeaderWithLength<H>, [T]>>
[src]
Converts a ThinArc
into an Arc
. This consumes the ThinArc
, so the refcount
is not modified.
Trait Implementations
impl<T> AsRef<T> for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Borrow<T> for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Clone for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> CloneStableDeref for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Debug for Arc<T> where
T: Debug + ?Sized,
[src]
T: Debug + ?Sized,
impl<T> Default for Arc<T> where
T: Default,
[src]
T: Default,
impl<T> Deref for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<'de, T> Deserialize<'de> for Arc<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<Arc<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<Arc<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl<T> Display for Arc<T> where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> Drop for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Eq for Arc<T> where
T: Eq + ?Sized,
[src]
T: Eq + ?Sized,
impl<T> From<T> for Arc<T>
[src]
impl<T> Hash for Arc<T> where
T: Hash + ?Sized,
[src]
T: Hash + ?Sized,
pub fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Ord for Arc<T> where
T: Ord + ?Sized,
[src]
T: Ord + ?Sized,
pub fn cmp(&self, other: &Arc<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T> PartialEq<Arc<T>> for Arc<T> where
T: PartialEq<T> + ?Sized,
[src]
T: PartialEq<T> + ?Sized,
impl<T> PartialOrd<Arc<T>> for Arc<T> where
T: PartialOrd<T> + ?Sized,
[src]
T: PartialOrd<T> + ?Sized,
pub fn partial_cmp(&self, other: &Arc<T>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Arc<T>) -> bool
[src]
pub fn le(&self, other: &Arc<T>) -> bool
[src]
pub fn gt(&self, other: &Arc<T>) -> bool
[src]
pub fn ge(&self, other: &Arc<T>) -> bool
[src]
impl<T> Pointer for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Send for Arc<T> where
T: Sync + Send + ?Sized,
[src]
T: Sync + Send + ?Sized,
impl<T> Serialize for Arc<T> where
T: Serialize,
[src]
T: Serialize,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl<T> StableDeref for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Sync for Arc<T> where
T: Sync + Send + ?Sized,
[src]
T: Sync + Send + ?Sized,
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for Arc<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized> Unpin for Arc<T> where
T: Unpin,
T: Unpin,
impl<T: ?Sized> UnwindSafe for Arc<T> where
T: RefUnwindSafe + UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,