pub struct StringLiteral<'db> { /* private fields */ }Expand description
Implementations§
Source§impl<'db> StringLiteral<'db>
impl<'db> StringLiteral<'db>
Sourcepub const fn len(&self) -> usize
pub const fn len(&self) -> usize
The string’s length in octets (raw bytes), excluding any terminator. Divide by
char_width for a character count.
Sourcepub fn char_width(&self) -> u8
pub fn char_width(&self) -> u8
Bytes per character: 1 (byte / UTF-8), 2 (UTF-16), or 4 (UTF-32).
Sourcepub fn is_pascal(&self) -> bool
pub fn is_pascal(&self) -> bool
Whether the string is length-prefixed (Pascal-style) rather than terminated.
Sourcepub fn text(&self) -> Option<String>
pub fn text(&self) -> Option<String>
The decoded string as UTF-8, or None if the bytes can’t be read.
This is the semantic form, for search, matching, and analysis: undecodable units become the
Unicode replacement character (U+FFFD) rather than failing. For the pseudocode-faithful
rendering with control bytes shown as C escapes, use escaped.
Trait Implementations§
Source§impl<'db> Clone for StringLiteral<'db>
impl<'db> Clone for StringLiteral<'db>
Source§fn clone(&self) -> StringLiteral<'db>
fn clone(&self) -> StringLiteral<'db>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'db> Copy for StringLiteral<'db>
Source§impl Debug for StringLiteral<'_>
impl Debug for StringLiteral<'_>
impl Eq for StringLiteral<'_>
Source§impl Hash for StringLiteral<'_>
impl Hash for StringLiteral<'_>
Source§impl Ord for StringLiteral<'_>
impl Ord for StringLiteral<'_>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for StringLiteral<'_>
impl PartialEq for StringLiteral<'_>
Source§impl PartialOrd for StringLiteral<'_>
impl PartialOrd for StringLiteral<'_>
Auto Trait Implementations§
impl<'db> !RefUnwindSafe for StringLiteral<'db>
impl<'db> !Send for StringLiteral<'db>
impl<'db> !Sync for StringLiteral<'db>
impl<'db> !UnwindSafe for StringLiteral<'db>
impl<'db> Freeze for StringLiteral<'db>
impl<'db> Unpin for StringLiteral<'db>
impl<'db> UnsafeUnpin for StringLiteral<'db>
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