pub struct RawStr<'buf>(/* private fields */);Expand description
A &str with surrounding quotes removed; escape sequences are not decoded.
Implementations§
Source§impl<'buf> RawStr<'buf>
impl<'buf> RawStr<'buf>
Sourcepub fn eq_escape_aware(&self, other: &str) -> Result<bool, Warning>
pub fn eq_escape_aware(&self, other: &str) -> Result<bool, Warning>
Compare other against this raw &str, decoding any JSON escape
sequences in the &str on the fly without allocating.
Returns Ok(true)/Ok(false) for the comparison, or Err if the key
contains a decoding problem (an invalid escape or a control character) at
or before the first differing character.
Sourcepub fn eq_any_escape_aware(&self, other: &[&str]) -> bool
pub fn eq_any_escape_aware(&self, other: &[&str]) -> bool
Compare this raw &str against a list of &strs, decoding any JSON escape
sequences in the &str on the fly without allocating.
Returns true if any of the other &strs match self.
Sourcepub fn eq_any_escape_aware_ignore_ascii_case(&self, other: &[&str]) -> bool
pub fn eq_any_escape_aware_ignore_ascii_case(&self, other: &[&str]) -> bool
Like RawStr::eq_any_escape_aware, but compares ASCII letters case-insensitively.
Sourcepub fn as_unescaped_str(&self) -> &'buf str
pub fn as_unescaped_str(&self) -> &'buf str
Return the raw unescaped &str.
Sourcepub fn decode_escapes(&self) -> CaveatDeferred<Cow<'_, str>, Warning>
pub fn decode_escapes(&self) -> CaveatDeferred<Cow<'_, str>, Warning>
Return the &str with all escapes decoded.
Sourcepub fn has_escapes(
&self,
elem: &Element<'buf>,
) -> Caveat<PendingStr<'buf>, Warning>
pub fn has_escapes( &self, elem: &Element<'buf>, ) -> Caveat<PendingStr<'buf>, Warning>
Return a &str marked as either having escapes or not.
Sourcepub fn lexical_issues(&self) -> LexicalIssues
pub fn lexical_issues(&self) -> LexicalIssues
Report whether the string contains escape sequences and whether its decoded form contains non-printable ASCII, in a single pass without allocating.
This combines the escape test of RawStr::has_escapes with the printability
check a caller would otherwise run on a string returned from RawStr::decode_escapes.
Trait Implementations§
impl<'buf> Copy for RawStr<'buf>
impl<'buf> Eq for RawStr<'buf>
Source§impl<'buf> Ord for RawStr<'buf>
impl<'buf> Ord for RawStr<'buf>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'buf> PartialEq for RawStr<'buf>
impl<'buf> PartialEq for RawStr<'buf>
Source§impl<'buf> PartialOrd for RawStr<'buf>
impl<'buf> PartialOrd for RawStr<'buf>
impl<'buf> StructuralPartialEq for RawStr<'buf>
Auto Trait Implementations§
impl<'buf> Freeze for RawStr<'buf>
impl<'buf> RefUnwindSafe for RawStr<'buf>
impl<'buf> Send for RawStr<'buf>
impl<'buf> Sync for RawStr<'buf>
impl<'buf> Unpin for RawStr<'buf>
impl<'buf> UnsafeUnpin for RawStr<'buf>
impl<'buf> UnwindSafe for RawStr<'buf>
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<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> IntoCaveat for T
impl<T> IntoCaveat for T
Source§fn into_caveat<W>(self, warnings: Set<W>) -> Caveat<T, W>where
W: Warning,
fn into_caveat<W>(self, warnings: Set<W>) -> Caveat<T, W>where
W: Warning,
Caveat<T> by supplying a list of Warnings.Source§fn into_infallible_caveat(self) -> Caveat<Self, Infallible>
fn into_infallible_caveat(self) -> Caveat<Self, Infallible>
FromSchema is infallible a Caveat can be created using this method.