pub struct ImmutableWeakString<TAllocator = StdAllocator>where
TAllocator: Allocator,{ /* private fields */ }
Expand description
Represents a weak reference to an ImmutableString
.
Analogously to how ImmutableWeakArray
is a weak
reference to ImmutableArray
.
Implementations§
Source§impl<TAllocator: Allocator> ImmutableWeakString<TAllocator>
impl<TAllocator: Allocator> ImmutableWeakString<TAllocator>
Sourcepub fn upgrade(&self) -> Option<ImmutableString<TAllocator>>
pub fn upgrade(&self) -> Option<ImmutableString<TAllocator>>
Upgrades the ImmutableWeakString
to an ImmutableString
.
Returns None
if the ImmutableWeakString
is no longer valid, i.e.
the underlying memory has been deallocated. Otherwise returns
a new strong
Sourcepub fn strong_count(instance: &Self) -> usize
pub fn strong_count(instance: &Self) -> usize
Returns the number of strong references to the ImmutableWeakString
.
Sourcepub fn weak_count(instance: &Self) -> usize
pub fn weak_count(instance: &Self) -> usize
Returns the number of weak references to the ImmutableWeakString
.
Sourcepub fn release(self) -> bool
pub fn release(self) -> bool
Releases the ImmutableWeakString
. If this was the last weak reference,
it will deallocated the underlying memory and return true
.
Otherwise it will just return false
.
Trait Implementations§
Source§impl<TAllocator> Clone for ImmutableWeakString<TAllocator>
impl<TAllocator> Clone for ImmutableWeakString<TAllocator>
Source§fn clone(&self) -> ImmutableWeakString<TAllocator>
fn clone(&self) -> ImmutableWeakString<TAllocator>
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 moreAuto Trait Implementations§
impl<TAllocator> Freeze for ImmutableWeakString<TAllocator>
impl<TAllocator> RefUnwindSafe for ImmutableWeakString<TAllocator>
impl<TAllocator> Send for ImmutableWeakString<TAllocator>
impl<TAllocator> Sync for ImmutableWeakString<TAllocator>
impl<TAllocator> Unpin for ImmutableWeakString<TAllocator>
impl<TAllocator> UnwindSafe for ImmutableWeakString<TAllocator>
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