pub struct Str { /* private fields */ }Expand description
An owned, immutable in-memory representation of an Ion string.
use ion_rs::Str;
let s: Str = "hello!".into();
assert_eq!(s, "hello!");Implementations§
Source§impl Str
impl Str
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of UTF-8 encoded bytes in this string.
use ion_rs::Str;
let s: Str = "hello!".into();
assert_eq!(s.len(), 6);
// Note that the length returned is a number of UTF-8 bytes, not codepoints or graphemes.
let s: Str = "🚀🚀🚀".into();
assert_eq!(s.len(), 12);Trait Implementations§
impl Eq for Str
Source§impl Ord for Str
impl Ord for Str
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
Auto Trait Implementations§
impl Freeze for Str
impl RefUnwindSafe for Str
impl Send for Str
impl Sync for Str
impl Unpin for Str
impl UnsafeUnpin for Str
impl UnwindSafe for Str
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<V> IntoAnnotatedElement for V
impl<V> IntoAnnotatedElement for V
Source§fn with_annotations<I: IntoAnnotations>(self, annotations: I) -> Element
fn with_annotations<I: IntoAnnotations>(self, annotations: I) -> Element
Converts the value into an Element with the specified annotations.
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more