pub struct RawStr<'a> { /* private fields */ }Expand description
A JSON string as it appeared, plus the means to read what it means.
The two are different values: "kWh" and "kWh" are the same string
and different bytes. Comparison uses Self::decode; reproduction uses the
original span.
Implementations§
Source§impl<'a> RawStr<'a>
impl<'a> RawStr<'a>
Sourcepub fn decode(&self) -> Cow<'a, str>
pub fn decode(&self) -> Cow<'a, str>
The decoded value. Borrowed when the source contains no escape.
Total: an escape RFC 8259 does not define decodes to the character after
the backslash, and an unpaired surrogate — which no Rust str can
hold — to U+FFFD. Both are reported as
DeviationKind::InvalidStringEscape while the string is being
scanned, so nothing is silently normalised; Self::as_raw still has
the bytes.
Trait Implementations§
impl<'a> Eq for RawStr<'a>
impl<'a> StructuralPartialEq for RawStr<'a>
Auto Trait Implementations§
impl<'a> Forget for RawStr<'a>
impl<'a> Freeze for RawStr<'a>
impl<'a> Move for RawStr<'a>
impl<'a> RefUnwindSafe for RawStr<'a>
impl<'a> Send for RawStr<'a>
impl<'a> Sync for RawStr<'a>
impl<'a> Unpin for RawStr<'a>
impl<'a> UnsafeUnpin for RawStr<'a>
impl<'a> UnwindSafe for RawStr<'a>
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