pub struct JSInternedStrRef<'a, 'b> { /* private fields */ }Expand description
A double reference to an interned string inside Interner.
JSInternedStrRef::utf8 returns an Option, since not every UTF-16 string is fully
representable as a UTF-8 string (because of unpaired surrogates). However, every UTF-8
string is representable as a UTF-16 string, so JSInternedStrRef::utf8 returns a
&[u16].
Implementations§
Source§impl<'a, 'b> JSInternedStrRef<'a, 'b>
impl<'a, 'b> JSInternedStrRef<'a, 'b>
Sourcepub const fn utf8(&self) -> Option<&'a str>
pub const fn utf8(&self) -> Option<&'a str>
Returns the inner reference to the interned string in UTF-8 encoding.
if the string is not representable in UTF-8, returns None
Sourcepub const fn utf16(&self) -> &'b [u16]
pub const fn utf16(&self) -> &'b [u16]
Returns the inner reference to the interned string in UTF-16 encoding.
Sourcepub fn join<F, G, T>(self, f: F, g: G, prioritize_utf8: bool) -> T
pub fn join<F, G, T>(self, f: F, g: G, prioritize_utf8: bool) -> T
Joins the result of both possible strings into a common type.
If self is representable by a UTF-8 string and the prioritize_utf8 argument is set,
it will prioritize calling f, and will only call g if self is only representable by a
UTF-16 string. Otherwise, it will directly call g.
Sourcepub fn join_with_context<C, F, G, T>(
self,
f: F,
g: G,
ctx: C,
prioritize_utf8: bool,
) -> T
pub fn join_with_context<C, F, G, T>( self, f: F, g: G, ctx: C, prioritize_utf8: bool, ) -> T
Same as join, but where you can pass an additional context.
Useful when you have a &mut Context context that cannot be borrowed by both closures at
the same time.
Sourcepub fn into_common<C>(self, prioritize_utf8: bool) -> C
pub fn into_common<C>(self, prioritize_utf8: bool) -> C
Converts both string types into a common type C.
If self is representable by a UTF-8 string and the prioritize_utf8 argument is set, it
will prioritize converting its UTF-8 representation first, and will only convert its
UTF-16 representation if it is only representable by a UTF-16 string. Otherwise, it will
directly convert its UTF-16 representation.
Trait Implementations§
Source§impl<'a, 'b> Clone for JSInternedStrRef<'a, 'b>
impl<'a, 'b> Clone for JSInternedStrRef<'a, 'b>
Source§fn clone(&self) -> JSInternedStrRef<'a, 'b>
fn clone(&self) -> JSInternedStrRef<'a, 'b>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a, 'b> Copy for JSInternedStrRef<'a, 'b>
Source§impl<'a, 'b> Debug for JSInternedStrRef<'a, 'b>
impl<'a, 'b> Debug for JSInternedStrRef<'a, 'b>
Source§impl Display for JSInternedStrRef<'_, '_>
impl Display for JSInternedStrRef<'_, '_>
impl<'a, 'b> Eq for JSInternedStrRef<'a, 'b>
Source§impl<'a, 'b> Hash for JSInternedStrRef<'a, 'b>
impl<'a, 'b> Hash for JSInternedStrRef<'a, 'b>
Source§impl<'a, 'b> PartialEq for JSInternedStrRef<'a, 'b>
impl<'a, 'b> PartialEq for JSInternedStrRef<'a, 'b>
impl<'a, 'b> StructuralPartialEq for JSInternedStrRef<'a, 'b>
Auto Trait Implementations§
impl<'a, 'b> Freeze for JSInternedStrRef<'a, 'b>
impl<'a, 'b> RefUnwindSafe for JSInternedStrRef<'a, 'b>
impl<'a, 'b> Send for JSInternedStrRef<'a, 'b>
impl<'a, 'b> Sync for JSInternedStrRef<'a, 'b>
impl<'a, 'b> Unpin for JSInternedStrRef<'a, 'b>
impl<'a, 'b> UnsafeUnpin for JSInternedStrRef<'a, 'b>
impl<'a, 'b> UnwindSafe for JSInternedStrRef<'a, 'b>
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<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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.