pub(crate) struct ProtectedArc<P: ?Sized> {
    bomb: DropBomb,
    arc: Arc<P>,
}Expand description
An Arc, but containing a type which should only be dropped in certain places
In non #[cfg(test)] builds, this is just Arc<P>.
When testing, it has a drop bomb.  You must call .promise_dropping_is_ok.
It will panic if it’s simply dropped.
Fields§
§bomb: DropBombThe actual explosive (might be armed or disarmed)
arc: Arc<P>The underlying Arc
Implementations§
Source§impl<P: ?Sized> ProtectedArc<P>
 
impl<P: ?Sized> ProtectedArc<P>
Sourcepub(crate) fn new(arc: Arc<P>) -> Self
 
pub(crate) fn new(arc: Arc<P>) -> Self
Make a new ProtectedArc from a raw Arc
§CORRECTNESS
Presumably the Arc came from an uncontrolled external source, such as user code.
Sourcepub(crate) fn downgrade(&self) -> ProtectedWeak<P>
 
pub(crate) fn downgrade(&self) -> ProtectedWeak<P>
Obtain a ProtectedWeak from a &ProtectedArc
Sourcepub(crate) fn promise_dropping_is_ok(self) -> Arc<P>
 
pub(crate) fn promise_dropping_is_ok(self) -> Arc<P>
Convert back into an unprotected Arc
§CORRECTNESS
If the return value is dropped, the location must be suitable for that. Or, maybe the returned value is going to calling code in the external user, (which, therefore, wouldn’t pose a reentrancy hazard).
Trait Implementations§
Source§impl<P: ?Sized> Deref for ProtectedArc<P>
 
impl<P: ?Sized> Deref for ProtectedArc<P>
Auto Trait Implementations§
impl<P> Freeze for ProtectedArc<P>where
    P: ?Sized,
impl<P> RefUnwindSafe for ProtectedArc<P>where
    P: RefUnwindSafe + ?Sized,
impl<P> Send for ProtectedArc<P>
impl<P> Sync for ProtectedArc<P>
impl<P> Unpin for ProtectedArc<P>where
    P: ?Sized,
impl<P> UnwindSafe for ProtectedArc<P>where
    P: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
 
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
 
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more