[−][src]Struct elysees::ArcHandle
An atomically reference counted shared pointer
See the documentation for Arc
in the standard library. Unlike the
standard library Arc
, ArcHandle
does not support weak reference counting.
Implementations
impl<T> ArcHandle<T>
[src]
pub fn new(data: T) -> Self
[src]
Construct an ArcHandle<T>
pub fn into_raw(this: Self) -> *const T
[src]
Convert the ArcHandle<T>
to a raw pointer, suitable for use across FFI
Note: This returns a pointer to the data T, which is offset in the allocation.
It is recommended to use Arc for this.
pub unsafe fn from_raw(ptr: *const T) -> Self
[src]
Reconstruct the ArcHandle<T>
from a raw pointer obtained from into_raw()
Note: This raw pointer will be offset in the allocation and must be preceded by the atomic count.
It is recommended to use Arc
for this
pub fn borrow_arc<'a>(&'a self) -> ArcBorrow<'a, T>
[src]
Produce a pointer to the data that can be converted back
to an ArcHandle<T>
. This is basically an &ArcHandle<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 ArcHandle<T>
s if necessary.
pub fn with_arc<F, U>(&self, f: F) -> U where
F: FnOnce(&Arc<T>) -> U,
[src]
F: FnOnce(&Arc<T>) -> U,
Temporarily converts |self|
into a bonafide Arc
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 ArcHandle itself -- not the T within it -- for memory reporting.
pub fn into_arc(a: Self) -> Arc<T>
[src]
Converts an ArcHandle
into a Arc
. This consumes the ArcHandle
, so the refcount
is not modified.
pub fn from_arc(a: Arc<T>) -> Self
[src]
Converts a Arc
into an ArcHandle
. This consumes the Arc
, so the refcount
is not modified.
impl<T: ?Sized> ArcHandle<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> ArcHandle<T>
[src]
pub fn make_mut(this: &mut Self) -> &mut T
[src]
Makes a mutable reference to the ArcHandle
, cloning if necessary
This is functionally equivalent to Arc::make_mut
from the standard library.
If this ArcHandle
is uniquely owned, make_mut()
will provide a mutable
reference to the contents. If not, make_mut()
will create a new ArcHandle
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> ArcHandle<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?).
pub fn get_count(&self, ordering: LoadOrdering) -> usize
[src]
Get the reference count of this Arc
with a given memory ordering
impl<H, T> ArcHandle<HeaderSlice<H, [T]>>
[src]
pub fn from_header_and_iter<I>(header: H, items: I) -> Self 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> ArcHandle<HeaderSlice<HeaderWithLength<H>, [T]>>
[src]
pub fn into_thin(a: Self) -> ThinArc<H, T>
[src]
Converts an ArcHandle
into a ThinArc
. This consumes the ArcHandle
, so the refcount
is not modified.
pub fn from_thin(a: ThinArc<H, T>) -> Self
[src]
Converts a ThinArc
into an ArcHandle
. This consumes the ThinArc
, so the refcount
is not modified.
Trait Implementations
impl<T: ?Sized> AsRef<T> for ArcHandle<T>
[src]
impl<T: ?Sized> Borrow<T> for ArcHandle<T>
[src]
impl<T: ?Sized> Clone for ArcHandle<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: ?Sized> CloneStableDeref for ArcHandle<T>
[src]
impl<T: ?Sized + Debug> Debug for ArcHandle<T>
[src]
impl<T: Default> Default for ArcHandle<T>
[src]
impl<T: ?Sized> Deref for ArcHandle<T>
[src]
impl<'de, T: Deserialize<'de>> Deserialize<'de> for ArcHandle<T>
[src]
fn deserialize<D>(deserializer: D) -> Result<ArcHandle<T>, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl<T: ?Sized + Display> Display for ArcHandle<T>
[src]
impl<T: ?Sized> Drop for ArcHandle<T>
[src]
impl<T: ?Sized + Eq> Eq for ArcHandle<T>
[src]
impl<T> From<T> for ArcHandle<T>
[src]
impl<T: ?Sized + Hash> Hash for ArcHandle<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: ?Sized + Ord> Ord for ArcHandle<T>
[src]
fn cmp(&self, other: &ArcHandle<T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: ?Sized + PartialEq> PartialEq<ArcHandle<T>> for ArcHandle<T>
[src]
impl<T: ?Sized + PartialOrd> PartialOrd<ArcHandle<T>> for ArcHandle<T>
[src]
fn partial_cmp(&self, other: &ArcHandle<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &ArcHandle<T>) -> bool
[src]
fn le(&self, other: &ArcHandle<T>) -> bool
[src]
fn gt(&self, other: &ArcHandle<T>) -> bool
[src]
fn ge(&self, other: &ArcHandle<T>) -> bool
[src]
impl<T: ?Sized> Pointer for ArcHandle<T>
[src]
impl<T: ?Sized + Sync + Send> Send for ArcHandle<T>
[src]
impl<T: Serialize> Serialize for ArcHandle<T>
[src]
impl<T: ?Sized> StableDeref for ArcHandle<T>
[src]
impl<T: ?Sized + Sync + Send> Sync for ArcHandle<T>
[src]
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for ArcHandle<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized> Unpin for ArcHandle<T> where
T: Unpin,
T: Unpin,
impl<T: ?Sized> UnwindSafe for ArcHandle<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,
fn borrow_mut(&mut self) -> &mut T
[src]
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.
fn to_owned(&self) -> T
[src]
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.
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>,