pub struct ArcIdUsize(/* private fields */);
Expand description
An atomically referenced counted version of IdUsize
.
This exists primarily because it should be possible to look up
Arc<IdUsize>
’s by usize
’s in HashMap
’s.
While it is possible to look up Id
’s in HashMap
’s using
&usize
’s, it doesn’t work for Arc<IdUsize>
’s.
To workaround this limitation this ArcIdUsize
newtype
implements Borrow<usize>
, which passes it through the
Arc
to it’s inner IdUsize
.
Implementations§
Source§impl ArcIdUsize
impl ArcIdUsize
Sourcepub fn try_unwrap(this: ArcIdUsize) -> Result<IdUsize, ArcIdUsize>
pub fn try_unwrap(this: ArcIdUsize) -> Result<IdUsize, ArcIdUsize>
Returns the inner value, if the ArcId
has exactly one strong
reference.
§Errors
If there’s more than one strong reference to the
ArcIdUsize
, the ArcIdUsize
will be returned.
Sourcepub fn into_inner(this: ArcIdUsize) -> Option<IdUsize>
pub fn into_inner(this: ArcIdUsize) -> Option<IdUsize>
Returns the inner value, if the ArcIdUsize
has exactly
one strong reference.
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
Return the strong count of internal Arc
.
Trait Implementations§
Source§impl Borrow<usize> for ArcIdUsize
impl Borrow<usize> for ArcIdUsize
Source§impl Clone for ArcIdUsize
impl Clone for ArcIdUsize
Source§fn clone(&self) -> ArcIdUsize
fn clone(&self) -> ArcIdUsize
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ArcIdUsize
impl Debug for ArcIdUsize
Source§impl Hash for ArcIdUsize
impl Hash for ArcIdUsize
Source§impl PartialEq for ArcIdUsize
impl PartialEq for ArcIdUsize
impl Eq for ArcIdUsize
impl StructuralPartialEq for ArcIdUsize
Auto Trait Implementations§
impl Freeze for ArcIdUsize
impl !RefUnwindSafe for ArcIdUsize
impl Send for ArcIdUsize
impl Sync for ArcIdUsize
impl Unpin for ArcIdUsize
impl !UnwindSafe for ArcIdUsize
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key
and return true
if they are equal.