Struct widestring::utfstr::Utf32Str

source ·
pub struct Utf32Str { /* private fields */ }
Expand description

UTF-32 string slice for Utf32String.

Utf32Str is to Utf32String as str is to String.

Utf32Str slices are string slices that are always valid UTF-32 encoding. This is unlike the U32Str string slices, which may not have valid encoding. In this way, Utf32Str string slices most resemble native str slices of all the types in this crate.

§Examples

The easiest way to use Utf32Str is with the utf32str! macro to convert string literals into string slices at compile time:

use widestring::utf32str;
let hello = utf32str!("Hello, world!");

You can also convert a u32 slice directly, provided it is valid UTF-32:

use widestring::Utf32Str;

let sparkle_heart = [0x1f496];
let sparkle_heart = Utf32Str::from_slice(&sparkle_heart).unwrap();

assert_eq!("💖", sparkle_heart);

Since char slices are valid UTF-32, a slice of chars can be easily converted to a string slice:

use widestring::Utf32Str;

let sparkle_heart = ['💖'; 3];
let sparkle_heart = Utf32Str::from_char_slice(&sparkle_heart);

assert_eq!("💖💖💖", sparkle_heart);

Implementations§

source§

impl Utf32Str

source

pub const unsafe fn from_slice_unchecked(s: &[u32]) -> &Self

Converts a slice to a string slice without checking that the string contains valid UTF-32.

See the safe version, from_slice, for more information.

§Safety

This function is unsafe because it does not check that the slice passed to it is valid UTF-32. If this constraint is violated, undefined behavior results as it is assumed the Utf32Str is always valid UTF-32.

§Examples
use widestring::Utf32Str;

let sparkle_heart = vec![0x1f496];
let sparkle_heart = unsafe { Utf32Str::from_slice_unchecked(&sparkle_heart) };

assert_eq!("💖", sparkle_heart);
source

pub unsafe fn from_slice_unchecked_mut(s: &mut [u32]) -> &mut Self

Converts a mutable slice to a mutable string slice without checking that the string contains valid UTF-32.

See the safe version, from_slice_mut, for more information.

§Safety

This function is unsafe because it does not check that the slice passed to it is valid UTF-32. If this constraint is violated, undefined behavior results as it is assumed the Utf32Str is always valid UTF-32.

§Examples
use widestring::Utf32Str;

let mut sparkle_heart = vec![0x1f496];
let sparkle_heart = unsafe { Utf32Str::from_slice_unchecked_mut(&mut sparkle_heart) };

assert_eq!("💖", sparkle_heart);
source

pub unsafe fn from_boxed_slice_unchecked(s: Box<[u32]>) -> Box<Self>

Available on crate feature alloc only.

Converts a boxed slice to a boxed string slice without checking that the string contains valid UTF-32.

§Safety

This function is unsafe because it does not check if the string slice is valid UTF-32, and Utf32Str must always be valid UTF-32.

source

pub unsafe fn get_unchecked<I>(&self, index: I) -> &Self
where I: SliceIndex<[u32], Output = [u32]>,

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..))
}
source

pub unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut Self
where I: SliceIndex<[u32], Output = [u32]>,

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..))
}
source

pub const fn len(&self) -> usize

Returns the length of self.

This length is in the number of chars 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);
source

pub const fn is_empty(&self) -> bool

Returns true if the string has a length of zero.

source

pub const 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.

source

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.

source

pub const 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.

source

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.

source

pub const fn as_ustr(&self) -> &U32Str

Returns this string as a wide string slice of undefined encoding.

source

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.

source

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.

source

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.

source

pub fn into_boxed_slice(self: Box<Self>) -> Box<[u32]>

Available on crate feature alloc only.

Converts a boxed string into a boxed slice without copying or allocating.

source

pub fn into_utfstring(self: Box<Self>) -> Utf32String

Available on crate feature alloc only.

Converts a boxed string slice into an owned UTF string without copying or allocating.

source

pub fn repeat(&self, n: usize) -> Utf32String

Available on crate feature alloc only.

Creates a new owned string by repeating this string n times.

§Panics

This function will panic if the capacity would overflow.

source§

impl Utf32Str

source

pub fn from_slice(s: &[u32]) -> Result<&Self, Utf32Error>

Converts a slice of UTF-32 data to a string slice.

Not all slices of u32 values are valid to convert, since Utf32Str 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.

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_slice_unchecked, which has the same behavior but skips the check.

If you need an owned string, consider using Utf32String::from_vec instead.

Because you can stack-allocate a [u32; N], this function is one way to have a stack-allocated string. Indeed, the utf32str! macro does exactly this after converting from UTF-8 to UTF-32.

§Errors

Returns an error if the slice is not UTF-32 with a description as to why the provided slice is not UTF-32.

§Examples
use widestring::Utf32Str;

let sparkle_heart = vec![0x1f496];
let sparkle_heart = Utf32Str::from_slice(&sparkle_heart).unwrap();

assert_eq!("💖", sparkle_heart);

With incorrect values that return an error:

use widestring::Utf32Str;

let sparkle_heart = vec![0xd83d, 0xdc96]; // UTF-16 surrogates are invalid

assert!(Utf32Str::from_slice(&sparkle_heart).is_err());
source

pub fn from_slice_mut(s: &mut [u32]) -> Result<&mut Self, Utf32Error>

Converts a mutable slice of UTF-32 data to a mutable string slice.

Not all slices of u32 values are valid to convert, since Utf32Str 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.

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_slice_unchecked_mut, which has the same behavior but skips the check.

If you need an owned string, consider using Utf32String::from_vec instead.

Because you can stack-allocate a [u32; N], this function is one way to have a stack-allocated string. Indeed, the utf32str! macro does exactly this after converting from UTF-8 to UTF-32.

§Errors

Returns an error if the slice is not UTF-32 with a description as to why the provided slice is not UTF-32.

§Examples
use widestring::Utf32Str;

let mut sparkle_heart = vec![0x1f496];
let sparkle_heart = Utf32Str::from_slice_mut(&mut sparkle_heart).unwrap();

assert_eq!("💖", sparkle_heart);

With incorrect values that return an error:

use widestring::Utf32Str;

let mut sparkle_heart = vec![0xd83d, 0xdc96]; // UTF-16 surrogates are invalid

assert!(Utf32Str::from_slice_mut(&mut sparkle_heart).is_err());
source

pub const unsafe fn from_ustr_unchecked(s: &U32Str) -> &Self

Converts a wide string slice of undefined encoding to a UTF-32 string slice without checking if the string slice is valid UTF-32.

See the safe version, from_ustr, for more information.

§Safety

This function is unsafe because it does not check that the string slice passed to it is valid UTF-32. If this constraint is violated, undefined behavior results as it is assumed the Utf32Str is always valid UTF-32.

§Examples
use widestring::{Utf32Str, u32str};

let sparkle_heart = u32str!("💖");
let sparkle_heart = unsafe { Utf32Str::from_ustr_unchecked(sparkle_heart) };

assert_eq!("💖", sparkle_heart);
source

pub unsafe fn from_ustr_unchecked_mut(s: &mut U32Str) -> &mut Self

Converts a mutable wide string slice of undefined encoding to a mutable UTF-32 string slice without checking if the string slice is valid UTF-32.

See the safe version, from_ustr_mut, for more information.

§Safety

This function is unsafe because it does not check that the string slice passed to it is valid UTF-32. If this constraint is violated, undefined behavior results as it is assumed the Utf32Str is always valid UTF-32.

source

pub fn from_ustr(s: &U32Str) -> Result<&Self, Utf32Error>

Converts a wide string slice of undefined encoding to a UTF-32 string slice.

Since U32Str does not have a specified encoding, this conversion may fail if the U32Str does not contain valid UTF-32 data.

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_ustr_unchecked, which has the same behavior but skips the check.

§Errors

Returns an error if the string slice is not UTF-32 with a description as to why the provided string slice is not UTF-32.

§Examples
use widestring::{Utf32Str, u32str};

let sparkle_heart = u32str!("💖");
let sparkle_heart = Utf32Str::from_ustr(sparkle_heart).unwrap();

assert_eq!("💖", sparkle_heart);
source

pub fn from_ustr_mut(s: &mut U32Str) -> Result<&mut Self, Utf32Error>

Converts a mutable wide string slice of undefined encoding to a mutable UTF-32 string slice.

Since U32Str does not have a specified encoding, this conversion may fail if the U32Str does not contain valid UTF-32 data.

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_ustr_unchecked_mut, which has the same behavior but skips the check.

§Errors

Returns an error if the string slice is not UTF-32 with a description as to why the provided string slice is not UTF-32.

source

pub unsafe fn from_ucstr_unchecked(s: &U32CStr) -> &Self

Converts a wide C string slice to a UTF-32 string slice without checking if the string slice is valid UTF-32.

The resulting string slice does not contain the nul terminator.

See the safe version, from_ucstr, for more information.

§Safety

This function is unsafe because it does not check that the string slice passed to it is valid UTF-32. If this constraint is violated, undefined behavior results as it is assumed the Utf32Str is always valid UTF-32.

§Examples
use widestring::{Utf32Str, u32cstr};

let sparkle_heart = u32cstr!("💖");
let sparkle_heart = unsafe { Utf32Str::from_ucstr_unchecked(sparkle_heart) };

assert_eq!("💖", sparkle_heart);
source

pub unsafe fn from_ucstr_unchecked_mut(s: &mut U32CStr) -> &mut Self

Converts a mutable wide C string slice to a mutable UTF-32 string slice without checking if the string slice is valid UTF-32.

The resulting string slice does not contain the nul terminator.

See the safe version, from_ucstr_mut, for more information.

§Safety

This function is unsafe because it does not check that the string slice passed to it is valid UTF-32. If this constraint is violated, undefined behavior results as it is assumed the Utf32Str is always valid UTF-32.

source

pub fn from_ucstr(s: &U32CStr) -> Result<&Self, Utf32Error>

Converts a wide C string slice to a UTF-32 string slice.

The resulting string slice does not contain the nul terminator.

Since U32CStr does not have a specified encoding, this conversion may fail if the U32CStr does not contain valid UTF-32 data.

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_ucstr_unchecked, which has the same behavior but skips the check.

§Errors

Returns an error if the string slice is not UTF-32 with a description as to why the provided string slice is not UTF-32.

§Examples
use widestring::{Utf32Str, u32cstr};

let sparkle_heart = u32cstr!("💖");
let sparkle_heart = Utf32Str::from_ucstr(sparkle_heart).unwrap();

assert_eq!("💖", sparkle_heart);
source

pub unsafe fn from_ucstr_mut(s: &mut U32CStr) -> Result<&mut Self, Utf32Error>

Converts a mutable wide C string slice to a mutable UTF-32 string slice.

The resulting string slice does not contain the nul terminator.

Since U32CStr does not have a specified encoding, this conversion may fail if the U32CStr does not contain valid UTF-32 data.

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_ucstr_unchecked_mut, which has the same behavior but skips the check.

§Safety

This method is unsafe because you can violate the invariants of U16CStr when mutating the slice (i.e. by adding interior nul values).

§Errors

Returns an error if the string slice is not UTF-32 with a description as to why the provided string slice is not UTF-32.

source

pub const fn from_char_slice(s: &[char]) -> &Self

Converts a slice of chars to a string slice.

Since char slices are always valid UTF-32, this conversion always suceeds.

If you need an owned string, consider using Utf32String::from_chars instead.

§Examples
use widestring::Utf32Str;

let sparkle_heart = ['💖'];
let sparkle_heart = Utf32Str::from_char_slice(&sparkle_heart);

assert_eq!("💖", sparkle_heart);
source

pub fn from_char_slice_mut(s: &mut [char]) -> &mut Self

Converts a mutable slice of chars to a string slice.

Since char slices are always valid UTF-32, this conversion always suceeds.

If you need an owned string, consider using Utf32String::from_chars instead.

§Examples
use widestring::Utf32Str;

let mut sparkle_heart = ['💖'];
let sparkle_heart = Utf32Str::from_char_slice_mut(&mut sparkle_heart);

assert_eq!("💖", sparkle_heart);
source

pub const fn as_char_slice(&self) -> &[char]

Converts a string slice into a slice of chars.

source

pub fn as_char_slice_mut(&mut self) -> &mut [char]

Converts a mutable string slice into a mutable slice of chars.

source

pub fn to_string(&self) -> String

Available on crate feature alloc only.

Converts to a standard UTF-8 String.

Because this string is always valid UTF-32, the conversion is lossless and non-fallible.

source

pub fn get<I>(&self, index: I) -> Option<&Self>
where I: SliceIndex<[u32], Output = [u32]>,

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..));
source

pub fn get_mut<I>(&mut self, index: I) -> Option<&mut Self>
where I: SliceIndex<[u32], Output = [u32]>,

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());
source

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);
source

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);
source

pub fn chars(&self) -> CharsUtf32<'_>

Returns an iterator over the chars 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.

source

pub fn char_indices(&self) -> CharIndicesUtf32<'_>

Returns an iterator over the chars 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 chars as well as their offsets.

The iterator yields tuples. The position is first, the char is second.

source

pub fn encode_utf8(&self) -> EncodeUtf8<CharsUtf32<'_>>

Returns an iterator of bytes over the string encoded as UTF-8.

source

pub fn encode_utf16(&self) -> EncodeUtf16<CharsUtf32<'_>>

Returns an iterator of u16 over the sting encoded as UTF-16.

source

pub fn escape_debug(&self) -> EscapeDebug<CharsUtf32<'_>>

Returns an iterator that escapes each char in self with char::escape_debug.

source

pub fn escape_default(&self) -> EscapeDefault<CharsUtf32<'_>>

Returns an iterator that escapes each char in self with char::escape_default.

source

pub fn escape_unicode(&self) -> EscapeUnicode<CharsUtf32<'_>>

Returns an iterator that escapes each char in self with char::escape_unicode.

source

pub fn to_lowercase(&self) -> Utf32String

Available on crate feature alloc only.

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.

source

pub fn to_uppercase(&self) -> Utf32String

Available on crate feature alloc only.

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 U32String

Available on crate feature alloc only.
§

type Output = U32String

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Utf32Str) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&Utf32Str> for Utf32String

Available on crate feature alloc only.
§

type Output = Utf32String

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Utf32Str) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<&Utf32Str> for U32String

Available on crate feature alloc only.
source§

fn add_assign(&mut self, rhs: &Utf32Str)

Performs the += operation. Read more
source§

impl AddAssign<&Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn add_assign(&mut self, rhs: &Utf32Str)

Performs the += operation. Read more
source§

impl AsMut<[char]> for Utf32Str

source§

fn as_mut(&mut self) -> &mut [char]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Utf32Str> for Utf32Str

source§

fn as_mut(&mut self) -> &mut Utf32Str

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn as_mut(&mut self) -> &mut Utf32Str

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[char]> for Utf32Str

source§

fn as_ref(&self) -> &[char]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[u32]> for Utf32Str

source§

fn as_ref(&self) -> &[u32]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<U32Str> for Utf32Str

source§

fn as_ref(&self) -> &U32Str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Utf32Str> for Utf32Str

source§

fn as_ref(&self) -> &Utf32Str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn as_ref(&self) -> &Utf32Str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn borrow(&self) -> &Utf32Str

Immutably borrows from an owned value. Read more
source§

impl BorrowMut<Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn borrow_mut(&mut self) -> &mut Utf32Str

Mutably borrows from an owned value. Read more
source§

impl Debug for Utf32Str

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for &Utf32Str

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Default for &mut Utf32Str

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for Utf32Str

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Extend<&'a Utf32Str> for U32String

Available on crate feature alloc only.
source§

fn extend<T: IntoIterator<Item = &'a Utf32Str>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<'a> Extend<&'a Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn extend<T: IntoIterator<Item = &'a Utf32Str>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<'a> From<&'a [char]> for &'a Utf32Str

source§

fn from(value: &'a [char]) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a Utf32Str> for &'a [char]

source§

fn from(value: &'a Utf32Str) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a Utf32Str> for &'a [u32]

source§

fn from(value: &'a Utf32Str) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a Utf32Str> for &'a U32Str

source§

fn from(value: &'a Utf32Str) -> Self

Converts to this type from the input type.
source§

impl From<&Utf32Str> for OsString

source§

fn from(value: &Utf32Str) -> OsString

Converts to this type from the input type.
source§

impl From<&Utf32Str> for String

Available on crate feature alloc only.
source§

fn from(value: &Utf32Str) -> Self

Converts to this type from the input type.
source§

impl From<&Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn from(value: &Utf32Str) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut [char]> for &'a mut Utf32Str

source§

fn from(value: &'a mut [char]) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut Utf32Str> for &'a mut [char]

source§

fn from(value: &'a mut Utf32Str) -> Self

Converts to this type from the input type.
source§

impl From<&mut Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn from(value: &mut Utf32Str) -> Self

Converts to this type from the input type.
source§

impl<'a> FromIterator<&'a Utf32Str> for U32String

Available on crate feature alloc only.
source§

fn from_iter<T: IntoIterator<Item = &'a Utf32Str>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> FromIterator<&'a Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn from_iter<T: IntoIterator<Item = &'a Utf32Str>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Hash for Utf32Str

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
source§

impl<I> Index<I> for Utf32Str
where I: SliceIndex<[u32], Output = [u32]>,

§

type Output = Utf32Str

The returned type after indexing.
source§

fn index(&self, index: I) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<I> IndexMut<I> for Utf32Str
where I: SliceIndex<[u32], Output = [u32]>,

source§

fn index_mut(&mut self, index: I) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl Ord for Utf32Str

source§

fn cmp(&self, other: &Utf32Str) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl PartialEq<&Utf16Str> for Utf32Str

source§

fn eq(&self, other: &&Utf16Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<&'a Utf32Str> for Cow<'b, Utf32Str>

source§

fn eq(&self, other: &&'a Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<&'a Utf32Str> for Cow<'b, str>

source§

fn eq(&self, other: &&'a Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&Utf32Str> for Utf16Str

source§

fn eq(&self, other: &&Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&Utf32Str> for Utf16String

Available on crate feature alloc only.
source§

fn eq(&self, other: &&Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn eq(&self, other: &&Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&str> for Utf32Str

source§

fn eq(&self, other: &&str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<[char]> for Utf32Str

source§

fn eq(&self, other: &[char]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<Cow<'a, Utf32Str>> for &'b Utf32Str

source§

fn eq(&self, other: &Cow<'a, Utf32Str>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<Cow<'a, str>> for &'b Utf32Str

source§

fn eq(&self, other: &Cow<'a, str>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<String> for Utf32Str

Available on crate feature alloc only.
source§

fn eq(&self, other: &String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<U32CStr> for Utf32Str

source§

fn eq(&self, other: &U32CStr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<U32CString> for Utf32Str

Available on crate feature alloc only.
source§

fn eq(&self, other: &U32CString) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<U32Str> for Utf32Str

source§

fn eq(&self, other: &U32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<U32String> for Utf32Str

Available on crate feature alloc only.
source§

fn eq(&self, other: &U32String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf16Str> for &Utf32Str

source§

fn eq(&self, other: &Utf16Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf16Str> for Utf32Str

source§

fn eq(&self, other: &Utf16Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf16String> for &Utf32Str

Available on crate feature alloc only.
source§

fn eq(&self, other: &Utf16String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for &Utf16Str

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for &Utf32Str

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for &str

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for [char]

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for Cow<'_, Utf32Str>

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for Cow<'_, str>

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for String

Available on crate feature alloc only.
source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for U32CStr

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for U32CString

Available on crate feature alloc only.
source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for U32Str

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for U32String

Available on crate feature alloc only.
source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for Utf16Str

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for Utf32String

Available on crate feature alloc only.
source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32Str> for str

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32String> for &Utf32Str

Available on crate feature alloc only.
source§

fn eq(&self, other: &Utf32String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Utf32String> for Utf32Str

Available on crate feature alloc only.
source§

fn eq(&self, other: &Utf32String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<str> for &Utf32Str

source§

fn eq(&self, other: &str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<str> for Utf32Str

source§

fn eq(&self, other: &str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Utf32Str

source§

fn eq(&self, other: &Utf32Str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Utf32Str

source§

fn partial_cmp(&self, other: &Utf32Str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl ToOwned for Utf32Str

Available on crate feature alloc only.
§

type Owned = Utf32String

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<'a> TryFrom<&'a [u32]> for &'a Utf32Str

§

type Error = Utf32Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a [u32]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a U32CStr> for &'a Utf32Str

§

type Error = Utf32Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a U32CStr) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a U32Str> for &'a Utf32Str

§

type Error = Utf32Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a U32Str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a mut [u32]> for &'a mut Utf32Str

§

type Error = Utf32Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a mut [u32]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Utf32Str

source§

impl StructuralPartialEq for Utf32Str

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more