Struct tiptoe::Arc [−][src]
#[repr(transparent)]pub struct Arc<T: ?Sized + IntrusivelyCountable> { /* fields omitted */ }
Expand description
An asynchronously reference-counted smart pointer (copy-on-write single-item container).
Unlike with alloc::sync::Arc
, the reference-count must be embedded in the payload instance itself.
Implementations
Creates a new instance of Arc<_>
by moving value
into a new heap allocation.
This increases the intrusive reference-count by 1.
Calling this method with an instance with non-zero reference-count is safe, but likely to lead to memory leaks (or the process being aborted, if the recorded count is very high).
Creates a new instance of Pin<Arc<_>>
by moving value
into a new heap allocation.
This increases the intrusive reference-count by 1.
Calling this method with an instance with non-zero reference-count is safe, but likely to lead to memory leaks (or the process being aborted, if the recorded count is very high).
Constructs an Arc
instance from a compatible value pointer.
Safety
The pointer raw_value
must have been created by leaking the heap-allocated value in a compatible unpinned container.
Containers are incompatible if their type parameter differs in a way that makes the equivalent pointer reinterpretation cast invalid. Otherwise:
(Arc
and Rc
are compatible.
Box
is compatible iff the internal reference count had been incremented to at least 1
at the time of leaking.)
For every time the instance that pointer points to was leaked, this function must be called at most once.
The data raw_value
points to may be in use only by Arc
.
Constructs a pinned Arc
instance from a compatible value pointer.
Safety
The pointer raw_value
must have been created by leaking the heap-allocated value in a compatible container.
Containers are incompatible if their type parameter differs in a way that makes the equivalent pointer reinterpretation cast invalid. Otherwise:
(Arc
and Rc
are compatible.
Box
is compatible iff the internal reference count had been incremented to at least 1
at the time of leaking.)
For every time the instance that pointer points to was leaked, this function must be called at most once.
The data raw_value
points to may be in use only by Arc
.
Unwraps the payload pointer contained in the current instance.
This does not decrease the reference-count.
Unwraps the payload pointer contained in the current instance.
This does not decrease the reference-count.
Safety Notes
Keep in mind that the pinning invariants, including the drop guarantee, must still be upheld.
Checks whether two instances of Arc<T>
point to the same instance.
Ensures the payload is exclusively pointed to by this Arc<T>
, cloning it if necessary,
and gives access to a Pin<&mut T>
that safely can not be used to clone the Arc<T>
.
Checks whether the payload is exclusively pointed to by this Arc<T>
and, if this is the case,
gives access to a Pin<&mut T>
that safely can not be used to clone the Arc<T>
.
Trait Implementations
impl<T: ?Sized + IntrusivelyCountable, O: ?Sized + IntrusivelyCountable> PartialEq<Arc<O>> for Arc<T> where
T: PartialEq<O>,
impl<T: ?Sized + IntrusivelyCountable, O: ?Sized + IntrusivelyCountable> PartialEq<Arc<O>> for Arc<T> where
T: PartialEq<O>,
impl<T: ?Sized + IntrusivelyCountable, O: ?Sized + IntrusivelyCountable> PartialOrd<Arc<O>> for Arc<T> where
T: PartialOrd<O>,
impl<T: ?Sized + IntrusivelyCountable, O: ?Sized + IntrusivelyCountable> PartialOrd<Arc<O>> for Arc<T> where
T: PartialOrd<O>,
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for Arc<T> where
T: RefUnwindSafe,
impl<T: ?Sized> UnwindSafe for Arc<T> where
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Pipes by value. This is generally the method you want to use. Read more
Borrows self
and passes that borrow into the pipe function. Read more
Mutably borrows self
and passes that borrow into the pipe function. Read more
Borrows self
, then passes self.borrow()
into the pipe function. Read more
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
Borrows self
, then passes self.as_ref()
into the pipe function.
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
Borrows self
, then passes self.deref()
into the pipe function.
Immutable access to the Borrow<B>
of a value. Read more
Mutable access to the BorrowMut<B>
of a value. Read more
Immutable access to the AsRef<R>
view of a value. Read more
Mutable access to the AsMut<R>
view of a value. Read more
Immutable access to the Deref::Target
of a value. Read more
Mutable access to the Deref::Target
of a value. Read more
Calls .tap()
only in debug builds, and is erased in release builds.
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_deref()
only in debug builds, and is erased in release
builds. Read more