pub struct ArcRef<T> { /* private fields */ }Expand description
Custom ArcRef type that wraps a Arc with RefCell without Making it difficult to type.
Implementations§
Source§impl<T> ArcRef<T>
impl<T> ArcRef<T>
Sourcepub fn clone(&self) -> ArcRef<T>
pub fn clone(&self) -> ArcRef<T>
Creata a clone of the ArcRef. This will atomically increment the reference count.
Sourcepub fn wait_borrow(&self) -> Ref<'_, T>
pub fn wait_borrow(&self) -> Ref<'_, T>
Borrow the value immutably. This will atomically increment the reference count. If the value is already borrowed mutably, this will block until the mutable borrow is released. NOTE: In debug mode, this will panic if the value is already borrowed immutably for more than 5 seconds.
Sourcepub fn wait_borrow_mut(&self) -> RefMut<'_, T>
pub fn wait_borrow_mut(&self) -> RefMut<'_, T>
Borrow the value mutably. This will atomically increment the reference count. If the value is already borrowed, this will block until the borrow is released. NOTE: In debug mode, this will panic if the value is already borrowed mutably for more than 5 seconds.
Sourcepub fn borrow(&self) -> Ref<'_, T>
pub fn borrow(&self) -> Ref<'_, T>
Try to borrow the value immutably. This will atomically increment the reference count. Will panic if the value is already borrowed mutably.
Sourcepub fn borrow_mut(&self) -> RefMut<'_, T>
pub fn borrow_mut(&self) -> RefMut<'_, T>
Try to borrow the value mutably. This will atomically increment the reference count. Will panic if the value is already borrowed.
Sourcepub fn try_borrow(&self) -> Option<Ref<'_, T>>
pub fn try_borrow(&self) -> Option<Ref<'_, T>>
Try to borrow the value immutably. This will atomically increment the reference count. Will return None if the value is already borrowed mutably.
Sourcepub fn try_borrow_mut(&self) -> Option<RefMut<'_, T>>
pub fn try_borrow_mut(&self) -> Option<RefMut<'_, T>>
Try to borrow the value mutably. This will atomically increment the reference count. Will return None if the value is already borrowed.
Sourcepub fn try_unwrap(self) -> Result<T, Self>
pub fn try_unwrap(self) -> Result<T, Self>
Try to unwrap the ArcRef. This will return the inner value if there are no other references to it. If there are other references, this will return the ArcRef itself as an error.
pub fn ptr_eq(&self, other: &Self) -> bool
pub fn as_ptr(_self: &Self) -> *const T
Trait Implementations§
impl<T: PartialEq> Eq for ArcRef<T>
Auto Trait Implementations§
impl<T> Freeze for ArcRef<T>
impl<T> !RefUnwindSafe for ArcRef<T>
impl<T> !Send for ArcRef<T>
impl<T> !Sync for ArcRef<T>
impl<T> Unpin for ArcRef<T>
impl<T> !UnwindSafe for ArcRef<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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>
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