Struct widestring::utfstring::Utf32String
source · pub struct Utf32String { /* private fields */ }
Expand description
A UTF-32 encoded, growable owned string.
Utf32String
is a version of String
that uses UTF-32 encoding instead of UTF-8
encoding. The equivalent of str
for Utf32String
is Utf32Str
.
Unlike U32String
which does not specify a coding, Utf32String
is
always valid UTF-32 encoding. Using unsafe methods to construct a Utf32String
with
invalid UTF-32 encoding results in undefined behavior.
§UTF-32
Utf32String
is always UTF-32. This means if you need non-UTF-32 wide strings, you should
use U32String
instead. It is similar, but does not constrain the
encoding.
Unlike UTF-16 or UTF-8 strings, you may index single elements of UTF-32 strings in addition
to subslicing. This is due to it being a fixed-length encoding for char
s. This also
means that Utf32String
is the same representation as a Vec<char>
; indeed conversions
between the two exist and are simple typecasts.
§Examples
The easiest way to use Utf32String
is with the utf32str!
macro to
convert string literals into UTF-32 string slices at compile time:
use widestring::{Utf32String, utf32str};
let hello = Utf32String::from(utf32str!("Hello, world!"));
Because this string is always valid UTF-32, it is a non-fallible, lossless conversion to and from standard Rust strings:
use widestring::Utf32String;
// Unlike the utf32str macro, this will do conversion at runtime instead of compile time
let hello = Utf32String::from_str("Hello, world!");
let hello_string: String = hello.to_string();
assert_eq!(hello, hello_string); // Can easily compare between string types
Implementations§
source§impl Utf32String
impl Utf32String
sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new empty string.
Given that the string is empty, this will not allocate any initial buffer. While
that means this initial operation is very inexpensive, it may cause excessive
allocations later when you add data. If you have an idea of how much data the
string will hold, consider with_capacity
instead to
prevent excessive re-allocation.
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new empty string with a particular capacity.
This string has an internal buffer to hold its data. The capacity is the length of
that buffer, and can be queried with the capacity
method. This
method creates and empty string, but one with an initial buffer that can hold
capacity
elements. This is useful when you may be appending a bunch of data to
the string, reducing the number of reallocations it needs to do.
If the given capacity is 0
, no allocation will occur, and this method is identical
to the new
method.
sourcepub unsafe fn from_vec_unchecked(v: impl Into<Vec<u32>>) -> Self
pub unsafe fn from_vec_unchecked(v: impl Into<Vec<u32>>) -> Self
Converts a u32
vector to a string without checking that the string contains valid
UTF-32.
See the safe version, from_vec
, for more information.
§Safety
This function is unsafe because it does not check that the vector passed to it is valid
UTF-32. If this constraint is violated, undefined behavior results as it is assumed the
Utf32String
is always valid UTF-32.
§Examples
use widestring::Utf32String;
let sparkle_heart = vec![0x1f496];
let sparkle_heart = unsafe { Utf32String::from_vec_unchecked(sparkle_heart) };
assert_eq!("💖", sparkle_heart);
sourcepub fn from_str<S: AsRef<str> + ?Sized>(s: &S) -> Self
pub fn from_str<S: AsRef<str> + ?Sized>(s: &S) -> Self
Re-encodes a UTF-8–encoded string slice into a UTF-32–encoded string.
This operation is lossless and infallible, but requires a memory allocation.
§Examples
use widestring::Utf32String;
let music = Utf32String::from_str("𝄞music");
assert_eq!(utf32str!("𝄞music"), music);
sourcepub fn as_mut_utfstr(&mut self) -> &mut Utf32Str
pub fn as_mut_utfstr(&mut self) -> &mut Utf32Str
Converts a string into a mutable string slice.
sourcepub fn as_ustr(&self) -> &U32Str
pub fn as_ustr(&self) -> &U32Str
Converts this string into a wide string of undefined encoding.
sourcepub fn into_vec(self) -> Vec<u32>
pub fn into_vec(self) -> Vec<u32>
Converts a string into a vector of its elements.
This consumes the string without copying its contents.
sourcepub fn push_utfstr<S: AsRef<Utf32Str> + ?Sized>(&mut self, string: &S)
pub fn push_utfstr<S: AsRef<Utf32Str> + ?Sized>(&mut self, string: &S)
Appends a given string slice onto the end of this string.
§Examples
use widestring::Utf32String;
let mut s = Utf32String::from_str("foo");
s.push_utfstr(utf32str!("bar"));
assert_eq!(utf32str!("foobar"), s);
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Ensures that this string’s capacity is at least additional
elements larger than
its length.
The capacity may be increased by more than additional
elements if it chooses, to
prevent frequent reallocations.
If you do not want this “at least” behavior, see the
reserve_exact
method.
§Panics
Panics if the new capacity overflows usize
.
sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of this string to match its length.
sourcepub fn shrink_to(&mut self, min_capacity: usize)
pub fn shrink_to(&mut self, min_capacity: usize)
Shrinks the capacity of this string with a lower bound.
The capacity will remain at least as large as both the length and the supplied value.
If the current capacity is less than the lower limit, this is a no-op.
sourcepub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u32>
pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u32>
Returns a mutable reference to the contents of this string.
§Safety
This function is unsafe because it does not check that the values in the vector are valid UTF-16. If this constraint is violated, it may cause undefined beahvior with future users of the string, as it is assumed that this string is always valid UTF-16.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of this string in number of elements, not char
s or
graphemes.
In other words, it might not be what a human considers the length of the string.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if this string has a length of zero, and false
otherwise.
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Truncates the string, removing all contents.
While this means the string will have a length of zero, it does not touch its capacity.
sourcepub fn into_boxed_utfstr(self) -> Box<Utf32Str>
pub fn into_boxed_utfstr(self) -> Box<Utf32Str>
Converts this string into a boxed string slice.
This will drop excess capacity.
source§impl Utf32String
impl Utf32String
sourcepub fn from_vec(v: impl Into<Vec<u32>>) -> Result<Self, Utf32Error>
pub fn from_vec(v: impl Into<Vec<u32>>) -> Result<Self, Utf32Error>
Converts a u32
vector of UTF-32 data to a string.
Not all slices of u32
values are valid to convert, since Utf32String
requires that
it is always valid UTF-32. This function checks to ensure that the values are valid UTF-32,
and then does the conversion. This does not do any copying.
If you are sure that the slice is valid UTF-32, and you don’t want to incur the overhead of
the validity check, there is an unsafe version of this function,
from_vec_unchecked
, which has the same behavior but skips
the check.
If you need a string slice, consider using Utf32Str::from_slice
instead.
The inverse of this method is into_vec
.
§Errors
Returns an error if the vector is not UTF-32 with a description as to why the provided
vector is not UTF-32. The error will contain the original Vec
that can be reclaimed with
into_vec
.
§Examples
use widestring::Utf32String;
let sparkle_heart = vec![0x1f496];
let sparkle_heart = Utf32String::from_vec(sparkle_heart).unwrap();
assert_eq!("💖", sparkle_heart);
With incorrect values that return an error:
use widestring::Utf32String;
let sparkle_heart = vec![0xd83d, 0xdc96]; // UTF-16 surrogates are invalid
assert!(Utf32String::from_vec(sparkle_heart).is_err());
sourcepub fn from_slice_lossy(s: &[u32]) -> Cow<'_, Utf32Str>
pub fn from_slice_lossy(s: &[u32]) -> Cow<'_, Utf32Str>
Converts a slice of u32
data to a string, including invalid characters.
Since the given u32
slice may not be valid UTF-32, and Utf32String
requires that
it is always valid UTF-32, during the conversion this function replaces any invalid UTF-32
sequences with U+FFFD REPLACEMENT CHARACTER
, which
looks like this: �
If you are sure that the slice is valid UTF-32, and you don’t want to incur the overhead of
the conversion, there is an unsafe version of this function,
from_vec_unchecked
, which has the same behavior but skips
the checks.
This function returns a Cow<'_, Utf32Str>
. If the given slice is
invalid UTF-32, then we need to insert our replacement characters which will change the size
of the string, and hence, require an owned Utf32String
. But if it’s already valid
UTF-32, we don’t need a new allocation. This return type allows us to handle both cases.
§Examples
use widestring::Utf32String;
let sparkle_heart = vec![0x1f496];
let sparkle_heart = Utf32String::from_slice_lossy(&sparkle_heart);
assert_eq!(utf32str!("💖"), sparkle_heart);
With incorrect values that return an error:
use widestring::Utf32String;
let sparkle_heart = vec![0xd83d, 0xdc96]; // UTF-16 surrogates are invalid
let sparkle_heart = Utf32String::from_slice_lossy(&sparkle_heart);
assert_eq!(utf32str!("\u{fffd}\u{fffd}"), sparkle_heart);
sourcepub unsafe fn from_ustring_unchecked(s: impl Into<U32String>) -> Self
pub unsafe fn from_ustring_unchecked(s: impl Into<U32String>) -> Self
Converts a wide string of undefined encoding to a UTF-32 string without checking that the string contains valid UTF-32.
See the safe version, from_ustring
, for more information.
§Safety
This function is unsafe because it does not check that the string passed to it is valid
UTF-32. If this constraint is violated, undefined behavior results as it is assumed the
Utf32String
is always valid UTF-32.
§Examples
use widestring::{U32String, Utf32String};
let sparkle_heart = vec![0x1f496];
let sparkle_heart = U32String::from_vec(sparkle_heart);
let sparkle_heart = unsafe { Utf32String::from_ustring_unchecked(sparkle_heart) };
assert_eq!("💖", sparkle_heart);
sourcepub fn from_ustring(s: impl Into<U32String>) -> Result<Self, Utf32Error>
pub fn from_ustring(s: impl Into<U32String>) -> Result<Self, Utf32Error>
Converts a wide string of undefined encoding string into a UTF-32 string.
Not all strings of undefined encoding are valid to convert, since Utf32String
requires
that it is always valid UTF-32. This function checks to ensure that the string is valid
UTF-32, and then does the conversion. This does not do any copying.
If you are sure that the string is valid UTF-32, and you don’t want to incur the overhead of
the validity check, there is an unsafe version of this function,
from_ustring_unchecked
, which has the same behavior but
skips the check.
If you need a string slice, consider using Utf32Str::from_ustr
instead.
§Errors
Returns an error if the string is not UTF-32 with a description as to why the provided string is not UTF-32.
§Examples
use widestring::{U32String, Utf32String};
let sparkle_heart = vec![0x1f496];
let sparkle_heart = U32String::from_vec(sparkle_heart);
let sparkle_heart = Utf32String::from_ustring(sparkle_heart).unwrap();
assert_eq!("💖", sparkle_heart);
With incorrect values that return an error:
use widestring::{U32String, Utf32String};
let sparkle_heart = vec![0xd83d, 0xdc96]; // UTF-16 surrogates are invalid
let sparkle_heart = U32String::from_vec(sparkle_heart); // Valid for a U32String
assert!(Utf32String::from_ustring(sparkle_heart).is_err()); // But not for a Utf32String
sourcepub fn from_ustr_lossy(s: &U32Str) -> Cow<'_, Utf32Str>
pub fn from_ustr_lossy(s: &U32Str) -> Cow<'_, Utf32Str>
Converts a wide string slice of undefined encoding to a UTF-32 string, including invalid characters.
Since the given string slice may not be valid UTF-32, and Utf32String
requires that
it is always valid UTF-32, during the conversion this function replaces any invalid UTF-32
sequences with U+FFFD REPLACEMENT CHARACTER
, which
looks like this: �
If you are sure that the slice is valid UTF-32, and you don’t want to incur the overhead of
the conversion, there is an unsafe version of this function,
from_ustring_unchecked
, which has the same behavior but
skips the checks.
This function returns a Cow<'_, Utf32Str>
. If the given slice is
invalid UTF-32, then we need to insert our replacement characters which will change the size
of the string, and hence, require an owned Utf32String
. But if it’s already valid
UTF-32, we don’t need a new allocation. This return type allows us to handle both cases.
§Examples
use widestring::{U32Str, Utf32String};
let sparkle_heart = vec![0x1f496];
let sparkle_heart = U32Str::from_slice(&sparkle_heart);
let sparkle_heart = Utf32String::from_ustr_lossy(sparkle_heart);
assert_eq!(utf32str!("💖"), sparkle_heart);
With incorrect values that return an error:
use widestring::{U32Str, Utf32String};
let sparkle_heart = vec![0xd83d, 0xdc96]; // UTF-16 surrogates are invalid
let sparkle_heart = U32Str::from_slice(&sparkle_heart);
let sparkle_heart = Utf32String::from_ustr_lossy(sparkle_heart);
assert_eq!(utf32str!("\u{fffd}\u{fffd}"), sparkle_heart);
sourcepub unsafe fn from_ucstring_unchecked(s: impl Into<U32CString>) -> Self
pub unsafe fn from_ucstring_unchecked(s: impl Into<U32CString>) -> Self
Converts a wide C string to a UTF-32 string without checking that the string contains valid UTF-32.
The resulting string does not contain the nul terminator.
See the safe version, from_ucstring
, for more information.
§Safety
This function is unsafe because it does not check that the string passed to it is valid
UTF-32. If this constraint is violated, undefined behavior results as it is assumed the
Utf32String
is always valid UTF-32.
§Examples
use widestring::{U32CString, Utf32String};
let sparkle_heart = vec![0x1f496];
let sparkle_heart = U32CString::from_vec(sparkle_heart).unwrap();
let sparkle_heart = unsafe { Utf32String::from_ucstring_unchecked(sparkle_heart) };
assert_eq!("💖", sparkle_heart);
sourcepub fn from_ucstring(s: impl Into<U32CString>) -> Result<Self, Utf32Error>
pub fn from_ucstring(s: impl Into<U32CString>) -> Result<Self, Utf32Error>
Converts a wide C string into a UTF-32 string.
The resulting string does not contain the nul terminator.
Not all wide C strings are valid to convert, since Utf32String
requires that
it is always valid UTF-32. This function checks to ensure that the string is valid UTF-32,
and then does the conversion. This does not do any copying.
If you are sure that the string is valid UTF-32, and you don’t want to incur the overhead of
the validity check, there is an unsafe version of this function,
from_ucstring_unchecked
, which has the same behavior but
skips the check.
If you need a string slice, consider using Utf32Str::from_ucstr
instead.
§Errors
Returns an error if the string is not UTF-32 with a description as to why the provided string is not UTF-32.
§Examples
use widestring::{U32CString, Utf32String};
let sparkle_heart = vec![0x1f496];
let sparkle_heart = U32CString::from_vec(sparkle_heart).unwrap();
let sparkle_heart = Utf32String::from_ucstring(sparkle_heart).unwrap();
assert_eq!("💖", sparkle_heart);
With incorrect values that return an error:
use widestring::{U32CString, Utf32String};
let sparkle_heart = vec![0xd83d, 0xdc96]; // UTF-16 surrogates are invalid
let sparkle_heart = U32CString::from_vec(sparkle_heart).unwrap(); // Valid for a U32CString
assert!(Utf32String::from_ucstring(sparkle_heart).is_err()); // But not for a Utf32String
sourcepub fn from_ucstr_lossy(s: &U32CStr) -> Cow<'_, Utf32Str>
pub fn from_ucstr_lossy(s: &U32CStr) -> Cow<'_, Utf32Str>
Converts a wide C string slice of to a UTF-32 string, including invalid characters.
The resulting string does not contain the nul terminator.
Since the given string slice may not be valid UTF-32, and Utf32String
requires that
it is always valid UTF-32, during the conversion this function replaces any invalid UTF-32
sequences with U+FFFD REPLACEMENT CHARACTER
, which
looks like this: �
If you are sure that the slice is valid UTF-32, and you don’t want to incur the overhead of
the conversion, there is an unsafe version of this function,
from_ucstring_unchecked
, which has the same behavior but
skips the checks.
This function returns a Cow<'_, Utf32Str>
. If the given slice is
invalid UTF-32, then we need to insert our replacement characters which will change the size
of the string, and hence, require an owned Utf32String
. But if it’s already valid
UTF-32, we don’t need a new allocation. This return type allows us to handle both cases.
§Examples
use widestring::{U32CStr, Utf32String};
let sparkle_heart = vec![0x1f496, 0x0];
let sparkle_heart = U32CStr::from_slice(&sparkle_heart).unwrap();
let sparkle_heart = Utf32String::from_ucstr_lossy(sparkle_heart);
assert_eq!(utf32str!("💖"), sparkle_heart);
With incorrect values that return an error:
use widestring::{U32CStr, Utf32String};
let sparkle_heart = vec![0xd83d, 0xdc96, 0x0]; // UTF-16 surrogates are invalid
let sparkle_heart = U32CStr::from_slice(&sparkle_heart).unwrap();
let sparkle_heart = Utf32String::from_ucstr_lossy(sparkle_heart);
assert_eq!(utf32str!("\u{fffd}\u{fffd}"), sparkle_heart);
sourcepub fn from_chars(s: impl Into<Vec<char>>) -> Self
pub fn from_chars(s: impl Into<Vec<char>>) -> Self
Converts a vector of char
s into a UTF-32 string.
Since char
s are always valid UTF-32, this is infallible and efficient.
If you need a string slice, consider using Utf32Str::from_char_slice
instead.
§Examples
use widestring::{U32CString, Utf32String};
let sparkle_heart = vec!['💖'];
let sparkle_heart = Utf32String::from_chars(sparkle_heart);
assert_eq!("💖", sparkle_heart);
sourcepub fn truncate(&mut self, new_len: usize)
pub fn truncate(&mut self, new_len: usize)
Shortens this string to the specified length.
If new_len
is greater than the string’s current length, this has no effect.
Note that this method has no effect on the allocated capacity of the string.
§Examples
use widestring::Utf32String;
let mut s = Utf32String::from_str("hello");
s.truncate(2);
assert_eq!("he", s);
sourcepub fn pop(&mut self) -> Option<char>
pub fn pop(&mut self) -> Option<char>
Removes the last character from the string buffer and returns it.
Returns None
if this string is empty.
§Examples
use widestring::Utf32String;
let mut s = Utf32String::from_str("foo");
assert_eq!(s.pop(), Some('o'));
assert_eq!(s.pop(), Some('o'));
assert_eq!(s.pop(), Some('f'));
assert_eq!(s.pop(), None);
sourcepub fn remove(&mut self, idx: usize) -> char
pub fn remove(&mut self, idx: usize) -> char
Removes a char
from this string at an offset and returns it.
This is an O(n) operation, as it requires copying every element in the buffer.
§Panics
Panics if idx
is larger than or equal to the string’s length.
§Examples
use widestring::Utf32String;
let mut s = Utf32String::from_str("foo");
assert_eq!(s.remove(1), 'o');
assert_eq!(s.remove(0), 'f');
assert_eq!(s.remove(0), 'o');
sourcepub fn retain<F>(&mut self, f: F)
pub fn retain<F>(&mut self, f: F)
Retains only the characters specified by the predicate.
In other words, remove all characters c
such that f(c)
returns false
. This method
operates in place, visiting each character exactly once in the original order, and preserves
the order of the retained characters.
§Examples
use widestring::Utf32String;
let mut s = Utf32String::from_str("f_o_ob_ar");
s.retain(|c| c != '_');
assert_eq!(s, "foobar");
Because the elements are visited exactly once in the original order, external state may be used to decide which elements to keep.
use widestring::Utf32String;
let mut s = Utf32String::from_str("abcde");
let keep = [false, true, true, false, true];
let mut iter = keep.iter();
s.retain(|_| *iter.next().unwrap());
assert_eq!(s, "bce");
sourcepub fn insert(&mut self, idx: usize, ch: char)
pub fn insert(&mut self, idx: usize, ch: char)
Inserts a character into this string at an offset.
This is an O(n) operation as it requires copying every element in the buffer.
§Panics
Panics if idx
is larger than the string’s length.
§Examples
use widestring::Utf32String;
let mut s = Utf32String::with_capacity(3);
s.insert(0, 'f');
s.insert(1, 'o');
s.insert(1, 'o');
assert_eq!("foo", s);
sourcepub fn insert_utfstr(&mut self, idx: usize, string: &Utf32Str)
pub fn insert_utfstr(&mut self, idx: usize, string: &Utf32Str)
Inserts a UTF-32 string slice into this string at an offset.
This is an O(n) operation as it requires copying every element in the buffer.
§Panics
Panics if idx
is larger than the string’s length.
§Examples
use widestring::Utf32String;
let mut s = Utf32String::from_str("bar");
s.insert_utfstr(0, utf32str!("foo"));
assert_eq!("foobar", s);
sourcepub fn split_off(&mut self, at: usize) -> Self
pub fn split_off(&mut self, at: usize) -> Self
Splits the string into two at the given index.
Returns a newly allocated string. self
contains elements [0, at), and the returned string
contains elements [at, len).
Note that the capacity of self
does not change.
§Panics
Panics if at
it is beyond the last code point of the string.
§Examples
use widestring::Utf32String;
let mut hello = Utf32String::from_str("Hello, World!");
let world = hello.split_off(7);
assert_eq!(hello, "Hello, ");
assert_eq!(world, "World!");
sourcepub fn drain<R>(&mut self, range: R) -> DrainUtf32<'_> ⓘwhere
R: RangeBounds<usize>,
pub fn drain<R>(&mut self, range: R) -> DrainUtf32<'_> ⓘwhere
R: RangeBounds<usize>,
Creates a draining iterator that removes the specified range in the string and yields the
removed char
s.
Note: The element range is removed even if the iterator is not consumed until the end.
§Panics
Panics if the starting point or end point are out of bounds.
§Examples
Basic usage:
use widestring::Utf32String;
let mut s = Utf32String::from_str("α is alpha, β is beta");
let beta_offset = 12;
// Remove the range up until the β from the string
let t: Utf32String = s.drain(..beta_offset).collect();
assert_eq!(t, "α is alpha, ");
assert_eq!(s, "β is beta");
// A full range clears the string
s.drain(..);
assert_eq!(s, "");
sourcepub fn replace_range<R>(&mut self, range: R, replace_with: &Utf32Str)where
R: RangeBounds<usize>,
pub fn replace_range<R>(&mut self, range: R, replace_with: &Utf32Str)where
R: RangeBounds<usize>,
Removes the specified range in the string, and replaces it with the given string.
The given string doesn’t need to be the same length as the range.
§Panics
Panics if the starting point or end point are out of bounds.
§Examples
Basic usage:
use widestring::{utf32str, Utf32String};
let mut s = Utf32String::from_str("α is alpha, β is beta");
let beta_offset = 12;
// Replace the range up until the β from the string
s.replace_range(..beta_offset, utf32str!("Α is capital alpha; "));
assert_eq!(s, "Α is capital alpha; β is beta");
Methods from Deref<Target = Utf32Str>§
sourcepub unsafe fn get_unchecked<I>(&self, index: I) -> &Self
pub unsafe fn get_unchecked<I>(&self, index: I) -> &Self
Returns an unchecked subslice of this string slice.
This is the unchecked alternative to indexing the string slice.
§Safety
Callers of this function are responsible that these preconditions are satisfied:
- The starting index must not exceed the ending index;
- Indexes must be within bounds of the original slice;
Failing that, the returned string slice may reference invalid memory or violate the invariants communicated by the type.
§Examples
let v = utf32str!("⚧️🏳️⚧️➡️s");
unsafe {
assert_eq!(utf32str!("⚧️"), v.get_unchecked(..2));
assert_eq!(utf32str!("🏳️⚧️"), v.get_unchecked(2..7));
assert_eq!(utf32str!("➡️"), v.get_unchecked(7..9));
assert_eq!(utf32str!("s"), v.get_unchecked(9..))
}
sourcepub unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut Self
pub unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut Self
Returns a mutable, unchecked subslice of this string slice
This is the unchecked alternative to indexing the string slice.
§Safety
Callers of this function are responsible that these preconditions are satisfied:
- The starting index must not exceed the ending index;
- Indexes must be within bounds of the original slice;
Failing that, the returned string slice may reference invalid memory or violate the invariants communicated by the type.
§Examples
let mut v = utf32str!("⚧️🏳️⚧️➡️s").to_owned();
unsafe {
assert_eq!(utf32str!("⚧️"), v.get_unchecked_mut(..2));
assert_eq!(utf32str!("🏳️⚧️"), v.get_unchecked_mut(2..7));
assert_eq!(utf32str!("➡️"), v.get_unchecked_mut(7..9));
assert_eq!(utf32str!("s"), v.get_unchecked_mut(9..))
}
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of self
.
This length is in the number of char
s in the slice, not graphemes. In other words, it
may not be what human considers the length of the string.
§Examples
assert_eq!(utf32str!("foo").len(), 3);
let complex = utf32str!("⚧️🏳️⚧️➡️s");
assert_eq!(complex.len(), 10);
assert_eq!(complex.chars().count(), 10);
sourcepub fn as_slice(&self) -> &[u32]
pub fn as_slice(&self) -> &[u32]
Converts a string to a slice of its underlying elements.
To convert the slice back into a string slice, use the
from_slice
function.
sourcepub unsafe fn as_mut_slice(&mut self) -> &mut [u32]
pub unsafe fn as_mut_slice(&mut self) -> &mut [u32]
Converts a mutable string to a mutable slice of its underlying elements.
§Safety
This function is unsafe because you can violate the invariants of this type when mutating the slice. The caller must ensure that the contents of the slice is valid UTF before the borrow ends and the underlying string is used.
Use of this string type whose contents have been mutated to invalid UTF is undefined behavior.
sourcepub fn as_ptr(&self) -> *const u32
pub fn as_ptr(&self) -> *const u32
Converts a string slice to a raw pointer.
This pointer will be pointing to the first element of the string slice.
The caller must ensure that the returned pointer is never written to. If you need to
mutate the contents of the string slice, use as_mut_ptr
.
sourcepub fn as_mut_ptr(&mut self) -> *mut u32
pub fn as_mut_ptr(&mut self) -> *mut u32
Converts a mutable string slice to a mutable pointer.
This pointer will be pointing to the first element of the string slice.
sourcepub fn as_ustr(&self) -> &U32Str
pub fn as_ustr(&self) -> &U32Str
Returns this string as a wide string slice of undefined encoding.
sourcepub fn trim(&self) -> &Self
pub fn trim(&self) -> &Self
Returns a string slice with leading and trailing whitespace removed.
‘Whitespace’ is defined according to the terms of the Unicode Derived Core Property
White_Space
.
sourcepub fn trim_start(&self) -> &Self
pub fn trim_start(&self) -> &Self
Returns a string slice with leading whitespace removed.
‘Whitespace’ is defined according to the terms of the Unicode Derived Core Property
White_Space
.
§Text directionality
A string is a sequence of elements. start
in this context means the first position
of that sequence; for a left-to-right language like English or Russian, this will be
left side, and for right-to-left languages like Arabic or Hebrew, this will be the
right side.
sourcepub fn trim_end(&self) -> &Self
pub fn trim_end(&self) -> &Self
Returns a string slice with trailing whitespace removed.
‘Whitespace’ is defined according to the terms of the Unicode Derived Core Property
White_Space
.
§Text directionality
A string is a sequence of elements. end
in this context means the last position of
that sequence; for a left-to-right language like English or Russian, this will be
right side, and for right-to-left languages like Arabic or Hebrew, this will be the
left side.
sourcepub fn repeat(&self, n: usize) -> Utf32String
pub fn repeat(&self, n: usize) -> Utf32String
Creates a new owned string by repeating this string n
times.
§Panics
This function will panic if the capacity would overflow.
sourcepub fn as_char_slice(&self) -> &[char]
pub fn as_char_slice(&self) -> &[char]
Converts a string slice into a slice of char
s.
sourcepub fn as_char_slice_mut(&mut self) -> &mut [char]
pub fn as_char_slice_mut(&mut self) -> &mut [char]
Converts a mutable string slice into a mutable slice of char
s.
sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
Converts to a standard UTF-8 String
.
Because this string is always valid UTF-32, the conversion is lossless and non-fallible.
sourcepub fn get<I>(&self, index: I) -> Option<&Self>
pub fn get<I>(&self, index: I) -> Option<&Self>
Returns a subslice of this string.
This is the non-panicking alternative to indexing the string. Returns None
whenever
equivalent indexing operation would panic.
§Examples
let v = utf32str!("⚧️🏳️⚧️➡️s");
assert_eq!(Some(utf32str!("⚧️")), v.get(..2));
assert_eq!(Some(utf32str!("🏳️⚧️")), v.get(2..7));
assert_eq!(Some(utf32str!("➡️")), v.get(7..9));
assert_eq!(Some(utf32str!("s")), v.get(9..));
sourcepub fn get_mut<I>(&mut self, index: I) -> Option<&mut Self>
pub fn get_mut<I>(&mut self, index: I) -> Option<&mut Self>
Returns a mutable subslice of this string.
This is the non-panicking alternative to indexing the string. Returns None
whenever
equivalent indexing operation would panic.
§Examples
let mut v = utf32str!("⚧️🏳️⚧️➡️s").to_owned();
assert_eq!(utf32str!("⚧️"), v.get_mut(..2).unwrap());
assert_eq!(utf32str!("🏳️⚧️"), v.get_mut(2..7).unwrap());
assert_eq!(utf32str!("➡️"), v.get_mut(7..9).unwrap());
assert_eq!(utf32str!("s"), v.get_mut(9..).unwrap());
sourcepub fn split_at(&self, mid: usize) -> (&Self, &Self)
pub fn split_at(&self, mid: usize) -> (&Self, &Self)
Divide one string slice into two at an index.
The argument, mid
, should be an offset from the start of the string.
The two slices returned go from the start of the string slice to mid
, and from mid
to
the end of the string slice.
To get mutable string slices instead, see the split_at_mut
method.
§Panics
Panics if mid
is past the end of the last code point of the string slice.
§Examples
let s = utf32str!("Per Martin-Löf");
let (first, last) = s.split_at(3);
assert_eq!("Per", first);
assert_eq!(" Martin-Löf", last);
sourcepub fn split_at_mut(&mut self, mid: usize) -> (&mut Self, &mut Self)
pub fn split_at_mut(&mut self, mid: usize) -> (&mut Self, &mut Self)
Divide one mutable string slice into two at an index.
The argument, mid
, should be an offset from the start of the string.
The two slices returned go from the start of the string slice to mid
, and from mid
to
the end of the string slice.
To get immutable string slices instead, see the split_at
method.
§Panics
Panics if mid
is past the end of the last code point of the string slice.
§Examples
let mut s = utf32str!("Per Martin-Löf").to_owned();
let (first, last) = s.split_at_mut(3);
assert_eq!("Per", first);
assert_eq!(" Martin-Löf", last);
sourcepub fn chars(&self) -> CharsUtf32<'_> ⓘ
pub fn chars(&self) -> CharsUtf32<'_> ⓘ
Returns an iterator over the char
s of a string slice.
As this string slice consists of valid UTF-32, we can iterate through a string slice by
char
. This method returns such an iterator.
It’s important to remember that char
represents a Unicode Scalar Value, and might not
match your idea of what a ‘character’ is. Iteration over grapheme clusters may be what you
actually want. This functionality is not provided by this crate.
sourcepub fn char_indices(&self) -> CharIndicesUtf32<'_> ⓘ
pub fn char_indices(&self) -> CharIndicesUtf32<'_> ⓘ
Returns an iterator over the char
s of a string slice and their positions.
As this string slice consists of valid UTF-32, we can iterate through a string slice by
char
. This method returns an iterator of both these char
s as well as their offsets.
The iterator yields tuples. The position is first, the char
is second.
sourcepub fn encode_utf8(&self) -> EncodeUtf8<CharsUtf32<'_>> ⓘ
pub fn encode_utf8(&self) -> EncodeUtf8<CharsUtf32<'_>> ⓘ
Returns an iterator of bytes over the string encoded as UTF-8.
sourcepub fn encode_utf16(&self) -> EncodeUtf16<CharsUtf32<'_>> ⓘ
pub fn encode_utf16(&self) -> EncodeUtf16<CharsUtf32<'_>> ⓘ
Returns an iterator of u16
over the sting encoded as UTF-16.
sourcepub fn escape_debug(&self) -> EscapeDebug<CharsUtf32<'_>> ⓘ
pub fn escape_debug(&self) -> EscapeDebug<CharsUtf32<'_>> ⓘ
Returns an iterator that escapes each char
in self
with char::escape_debug
.
sourcepub fn escape_default(&self) -> EscapeDefault<CharsUtf32<'_>> ⓘ
pub fn escape_default(&self) -> EscapeDefault<CharsUtf32<'_>> ⓘ
Returns an iterator that escapes each char
in self
with char::escape_default
.
sourcepub fn escape_unicode(&self) -> EscapeUnicode<CharsUtf32<'_>> ⓘ
pub fn escape_unicode(&self) -> EscapeUnicode<CharsUtf32<'_>> ⓘ
Returns an iterator that escapes each char
in self
with char::escape_unicode
.
sourcepub fn to_lowercase(&self) -> Utf32String
pub fn to_lowercase(&self) -> Utf32String
Returns the lowercase equivalent of this string slice, as a new Utf32String
.
‘Lowercase’ is defined according to the terms of the Unicode Derived Core Property
Lowercase
.
Since some characters can expand into multiple characters when changing the case, this
function returns a Utf32String
instead of modifying the parameter in-place.
sourcepub fn to_uppercase(&self) -> Utf32String
pub fn to_uppercase(&self) -> Utf32String
Returns the uppercase equivalent of this string slice, as a new Utf32String
.
‘Uppercase’ is defined according to the terms of the Unicode Derived Core Property
Uppercase
.
Since some characters can expand into multiple characters when changing the case, this
function returns a Utf32String
instead of modifying the parameter in-place.
Trait Implementations§
source§impl Add<&Utf32Str> for Utf32String
impl Add<&Utf32Str> for Utf32String
source§impl Add<&str> for Utf32String
impl Add<&str> for Utf32String
source§impl AddAssign<&Utf32Str> for Utf32String
impl AddAssign<&Utf32Str> for Utf32String
source§fn add_assign(&mut self, rhs: &Utf32Str)
fn add_assign(&mut self, rhs: &Utf32Str)
+=
operation. Read moresource§impl AddAssign<&str> for Utf32String
impl AddAssign<&str> for Utf32String
source§fn add_assign(&mut self, rhs: &str)
fn add_assign(&mut self, rhs: &str)
+=
operation. Read moresource§impl AsMut<[char]> for Utf32String
impl AsMut<[char]> for Utf32String
source§impl AsMut<Utf32Str> for Utf32String
impl AsMut<Utf32Str> for Utf32String
source§impl AsRef<[char]> for Utf32String
impl AsRef<[char]> for Utf32String
source§impl AsRef<[u32]> for Utf32String
impl AsRef<[u32]> for Utf32String
source§impl AsRef<U32Str> for Utf32String
impl AsRef<U32Str> for Utf32String
source§impl AsRef<Utf32Str> for Utf32String
impl AsRef<Utf32Str> for Utf32String
source§impl Borrow<Utf32Str> for Utf32String
impl Borrow<Utf32Str> for Utf32String
source§impl BorrowMut<Utf32Str> for Utf32String
impl BorrowMut<Utf32Str> for Utf32String
source§fn borrow_mut(&mut self) -> &mut Utf32Str
fn borrow_mut(&mut self) -> &mut Utf32Str
source§impl Clone for Utf32String
impl Clone for Utf32String
source§fn clone(&self) -> Utf32String
fn clone(&self) -> Utf32String
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Utf32String
impl Debug for Utf32String
source§impl Default for Utf32String
impl Default for Utf32String
source§fn default() -> Utf32String
fn default() -> Utf32String
source§impl Deref for Utf32String
impl Deref for Utf32String
source§impl DerefMut for Utf32String
impl DerefMut for Utf32String
source§impl Display for Utf32String
impl Display for Utf32String
source§impl<'a> Extend<&'a Utf32Str> for Utf32String
impl<'a> Extend<&'a Utf32Str> for Utf32String
source§fn extend<T: IntoIterator<Item = &'a Utf32Str>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = &'a Utf32Str>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<'a> Extend<&'a char> for Utf32String
impl<'a> Extend<&'a char> for Utf32String
source§fn extend<T: IntoIterator<Item = &'a char>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = &'a char>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<'a> Extend<&'a str> for Utf32String
impl<'a> Extend<&'a str> for Utf32String
source§fn extend<T: IntoIterator<Item = &'a str>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = &'a str>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Extend<Box<Utf32Str>> for Utf32String
impl Extend<Box<Utf32Str>> for Utf32String
source§fn extend<T: IntoIterator<Item = Box<Utf32Str>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Box<Utf32Str>>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<'a> Extend<Cow<'a, Utf32Str>> for Utf32String
impl<'a> Extend<Cow<'a, Utf32Str>> for Utf32String
source§fn extend<T: IntoIterator<Item = Cow<'a, Utf32Str>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Cow<'a, Utf32Str>>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Extend<String> for Utf32String
impl Extend<String> for Utf32String
source§fn extend<T: IntoIterator<Item = String>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = String>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Extend<Utf32String> for U32String
impl Extend<Utf32String> for U32String
source§fn extend<T: IntoIterator<Item = Utf32String>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Utf32String>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Extend<Utf32String> for Utf32String
impl Extend<Utf32String> for Utf32String
source§fn extend<T: IntoIterator<Item = Utf32String>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Utf32String>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Extend<char> for Utf32String
impl Extend<char> for Utf32String
source§fn extend<T: IntoIterator<Item = char>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = char>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl From<&[char]> for Utf32String
impl From<&[char]> for Utf32String
source§impl From<&Utf32Str> for Utf32String
impl From<&Utf32Str> for Utf32String
source§impl<'a> From<&'a Utf32String> for Cow<'a, Utf32Str>
impl<'a> From<&'a Utf32String> for Cow<'a, Utf32Str>
source§fn from(value: &'a Utf32String) -> Self
fn from(value: &'a Utf32String) -> Self
source§impl From<&Utf32String> for Utf32String
impl From<&Utf32String> for Utf32String
source§fn from(value: &Utf32String) -> Self
fn from(value: &Utf32String) -> Self
source§impl From<&mut Utf32Str> for Utf32String
impl From<&mut Utf32Str> for Utf32String
source§impl From<&str> for Utf32String
impl From<&str> for Utf32String
source§impl From<String> for Utf32String
impl From<String> for Utf32String
source§impl From<Utf32String> for Cow<'_, Utf32Str>
impl From<Utf32String> for Cow<'_, Utf32Str>
source§fn from(value: Utf32String) -> Self
fn from(value: Utf32String) -> Self
source§impl From<Utf32String> for OsString
impl From<Utf32String> for OsString
source§fn from(value: Utf32String) -> OsString
fn from(value: Utf32String) -> OsString
source§impl From<Utf32String> for String
impl From<Utf32String> for String
source§fn from(value: Utf32String) -> Self
fn from(value: Utf32String) -> Self
source§impl From<Utf32String> for U32String
impl From<Utf32String> for U32String
source§fn from(value: Utf32String) -> Self
fn from(value: Utf32String) -> Self
source§impl From<Utf32String> for Vec<char>
impl From<Utf32String> for Vec<char>
source§fn from(value: Utf32String) -> Self
fn from(value: Utf32String) -> Self
source§impl<'a> FromIterator<&'a Utf32Str> for Utf32String
impl<'a> FromIterator<&'a Utf32Str> for Utf32String
source§impl<'a> FromIterator<&'a char> for Utf32String
impl<'a> FromIterator<&'a char> for Utf32String
source§impl<'a> FromIterator<&'a str> for Utf32String
impl<'a> FromIterator<&'a str> for Utf32String
source§impl FromIterator<Box<Utf32Str>> for Utf32String
impl FromIterator<Box<Utf32Str>> for Utf32String
source§impl<'a> FromIterator<Cow<'a, Utf32Str>> for Utf32String
impl<'a> FromIterator<Cow<'a, Utf32Str>> for Utf32String
source§impl FromIterator<String> for Utf32String
impl FromIterator<String> for Utf32String
source§impl FromIterator<Utf32String> for U32String
impl FromIterator<Utf32String> for U32String
source§fn from_iter<T: IntoIterator<Item = Utf32String>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Utf32String>>(iter: T) -> Self
source§impl FromIterator<Utf32String> for Utf32String
impl FromIterator<Utf32String> for Utf32String
source§fn from_iter<T: IntoIterator<Item = Utf32String>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Utf32String>>(iter: T) -> Self
source§impl FromIterator<char> for Utf32String
impl FromIterator<char> for Utf32String
source§impl FromStr for Utf32String
impl FromStr for Utf32String
source§impl Hash for Utf32String
impl Hash for Utf32String
source§impl<I> Index<I> for Utf32String
impl<I> Index<I> for Utf32String
source§impl<I> IndexMut<I> for Utf32String
impl<I> IndexMut<I> for Utf32String
source§impl Ord for Utf32String
impl Ord for Utf32String
source§fn cmp(&self, other: &Utf32String) -> Ordering
fn cmp(&self, other: &Utf32String) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<&Utf16Str> for Utf32String
impl PartialEq<&Utf16Str> for Utf32String
source§impl PartialEq<&Utf32Str> for Utf32String
impl PartialEq<&Utf32Str> for Utf32String
source§impl PartialEq<&str> for Utf32String
impl PartialEq<&str> for Utf32String
source§impl PartialEq<[char]> for Utf32String
impl PartialEq<[char]> for Utf32String
source§impl PartialEq<Cow<'_, Utf32Str>> for Utf32String
impl PartialEq<Cow<'_, Utf32Str>> for Utf32String
source§impl PartialEq<Cow<'_, str>> for Utf32String
impl PartialEq<Cow<'_, str>> for Utf32String
source§impl PartialEq<String> for Utf32String
impl PartialEq<String> for Utf32String
source§impl PartialEq<U32CStr> for Utf32String
impl PartialEq<U32CStr> for Utf32String
source§impl PartialEq<U32CString> for Utf32String
impl PartialEq<U32CString> for Utf32String
source§fn eq(&self, other: &U32CString) -> bool
fn eq(&self, other: &U32CString) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<U32Str> for Utf32String
impl PartialEq<U32Str> for Utf32String
source§impl PartialEq<U32String> for Utf32String
impl PartialEq<U32String> for Utf32String
source§impl PartialEq<Utf16String> for Utf32String
impl PartialEq<Utf16String> for Utf32String
source§fn eq(&self, other: &Utf16String) -> bool
fn eq(&self, other: &Utf16String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32Str> for Utf32String
impl PartialEq<Utf32Str> for Utf32String
source§impl PartialEq<Utf32String> for &Utf16Str
impl PartialEq<Utf32String> for &Utf16Str
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for &Utf32Str
impl PartialEq<Utf32String> for &Utf32Str
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for &str
impl PartialEq<Utf32String> for &str
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for Cow<'_, Utf32Str>
impl PartialEq<Utf32String> for Cow<'_, Utf32Str>
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for Cow<'_, str>
impl PartialEq<Utf32String> for Cow<'_, str>
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for String
impl PartialEq<Utf32String> for String
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for U32CStr
impl PartialEq<Utf32String> for U32CStr
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for U32CString
impl PartialEq<Utf32String> for U32CString
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for U32Str
impl PartialEq<Utf32String> for U32Str
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for U32String
impl PartialEq<Utf32String> for U32String
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for Utf16String
impl PartialEq<Utf32String> for Utf16String
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for Utf32Str
impl PartialEq<Utf32String> for Utf32Str
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Utf32String> for str
impl PartialEq<Utf32String> for str
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<str> for Utf32String
impl PartialEq<str> for Utf32String
source§impl PartialEq for Utf32String
impl PartialEq for Utf32String
source§fn eq(&self, other: &Utf32String) -> bool
fn eq(&self, other: &Utf32String) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for Utf32String
impl PartialOrd for Utf32String
source§fn partial_cmp(&self, other: &Utf32String) -> Option<Ordering>
fn partial_cmp(&self, other: &Utf32String) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more