pub struct RefString(/* private fields */);
Expand description
A weak reference to a garbage collected, interned string.
Implementations§
Source§impl RefString
impl RefString
Sourcepub fn new<'a>(s: impl Into<Cow<'a, str>>) -> Self
pub fn new<'a>(s: impl Into<Cow<'a, str>>) -> Self
Returns a reference to a garbage collected string that contains s
.
If another RootString
or RefString
exists already with the same
contents as s
, it will be returned and s
will be dropped.
Sourcepub fn from_any(any: AnyRef) -> Option<Self>
pub fn from_any(any: AnyRef) -> Option<Self>
Upgrades a typeless reference to a pooled string reference.
Returns None
if any
is not a pooled string.
Sourcepub fn load<'guard>(
&self,
guard: &'guard CollectionGuard<'_>,
) -> Option<&'guard str>
pub fn load<'guard>( &self, guard: &'guard CollectionGuard<'_>, ) -> Option<&'guard str>
Loads a reference to the underlying string, if the string hasn’t been freed.
Sourcepub fn as_root(&self, guard: &CollectionGuard<'_>) -> Option<RootString>
pub fn as_root(&self, guard: &CollectionGuard<'_>) -> Option<RootString>
Loads this string as a root, if the string hasn’t been freed.
Trait Implementations§
Source§impl Ord for RefString
impl Ord for RefString
Source§impl PartialEq<RefString> for RootString
impl PartialEq<RefString> for RootString
Source§impl PartialEq<RootString> for RefString
impl PartialEq<RootString> for RefString
Source§impl PartialOrd for RefString
impl PartialOrd for RefString
impl Copy for RefString
impl Eq for RefString
impl StructuralPartialEq for RefString
Auto Trait Implementations§
impl Freeze for RefString
impl RefUnwindSafe for RefString
impl Send for RefString
impl Sync for RefString
impl Unpin for RefString
impl UnwindSafe for RefString
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