widestring::utfstring

Type Alias WideUtfString

Source
pub type WideUtfString = Utf32String;
Expand description

Alias for Utf16String or Utf32String depending on platform. Intended to match typical C wchar_t size on platform.

Aliased Type§

struct WideUtfString { /* private fields */ }

Implementations

Source§

impl Utf32String

Source

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.

Source

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.

Source

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

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

pub fn as_utfstr(&self) -> &Utf32Str

Converts a string into a string slice.

Source

pub fn as_mut_utfstr(&mut self) -> &mut Utf32Str

Converts a string into a mutable string slice.

Source

pub fn as_ustr(&self) -> &U32Str

Converts this string into a wide string of undefined encoding.

Source

pub fn into_vec(self) -> Vec<u32>

Converts a string into a vector of its elements.

This consumes the string without copying its contents.

Source

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

pub fn capacity(&self) -> usize

Returns this string’s capacity, in number of elements.

Source

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.

Source

pub fn reserve_exact(&mut self, additional: usize)

Ensures that this string’s capacity is additional elements larger than its length.

Consider using the reserve method unless you absolutely know better than the allocator.

§Panics

Panics if the new capacity overflows usize.

Source

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of this string to match its length.

Source

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.

Source

pub fn as_slice(&self) -> &[u32]

Returns a slice of this string’s contents.

Source

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.

Source

pub fn len(&self) -> usize

Returns the length of this string in number of elements, not chars or graphemes.

In other words, it might not be what a human considers the length of the string.

Source

pub fn is_empty(&self) -> bool

Returns true if this string has a length of zero, and false otherwise.

Source

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.

Source

pub fn into_boxed_utfstr(self) -> Box<Utf32Str>

Converts this string into a boxed string slice.

This will drop excess capacity.

Source

pub fn push_str<S: AsRef<str> + ?Sized>(&mut self, string: &S)

Appends a given UTF-8 string slice onto the end of this string, converting it to UTF-16.

Source§

impl Utf32String

Source

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

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

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

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
Source

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

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

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
Source

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

pub fn from_chars(s: impl Into<Vec<char>>) -> Self

Converts a vector of chars into a UTF-32 string.

Since chars 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);
Source

pub fn push(&mut self, ch: char)

Appends the given char to the end of this string.

§Examples
use widestring::Utf32String;
let mut s = Utf32String::from_str("abc");

s.push('1');
s.push('2');
s.push('3');

assert_eq!("abc123", s);
Source

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

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

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');
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(char) -> bool,

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");
Source

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

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

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 atit 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!");
Source

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 chars.

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, "");
Source

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");
Source

pub fn into_char_vec(self) -> Vec<char>

Converts string into a Vec of chars.

This consumes the string without copying its contents.

Trait Implementations

Source§

impl Add<&Utf32Str> for Utf32String

Source§

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 Add<&str> for Utf32String

Source§

type Output = Utf32String

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign<&Utf32Str> for Utf32String

Source§

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

Performs the += operation. Read more
Source§

impl AddAssign<&str> for Utf32String

Source§

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

Performs the += operation. Read more
Source§

impl AsMut<[char]> for Utf32String

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 Utf32String

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 Utf32String

Source§

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

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

impl AsRef<[u32]> for Utf32String

Source§

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

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

impl AsRef<U32Str> for Utf32String

Source§

fn as_ref(&self) -> &U32Str

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

impl AsRef<Utf32Str> for Utf32String

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

Source§

fn borrow(&self) -> &Utf32Str

Immutably borrows from an owned value. Read more
Source§

impl BorrowMut<Utf32Str> for Utf32String

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl Clone for Utf32String

Source§

fn clone(&self) -> Utf32String

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Utf32String

Source§

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

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

impl Default for Utf32String

Source§

fn default() -> Utf32String

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

impl Deref for Utf32String

Source§

type Target = Utf32Str

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Utf32String

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Display for Utf32String

Source§

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

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

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

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 char> for Utf32String

Source§

fn extend<T: IntoIterator<Item = &'a char>>(&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 str> for Utf32String

Source§

fn extend<T: IntoIterator<Item = &'a str>>(&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 Extend<Box<Utf32Str>> for Utf32String

Source§

fn extend<T: IntoIterator<Item = Box<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<Cow<'a, Utf32Str>> for Utf32String

Source§

fn extend<T: IntoIterator<Item = Cow<'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 Extend<String> for Utf32String

Source§

fn extend<T: IntoIterator<Item = String>>(&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 Extend<Utf32String> for Utf32String

Source§

fn extend<T: IntoIterator<Item = Utf32String>>(&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 Extend<char> for Utf32String

Source§

fn extend<T: IntoIterator<Item = char>>(&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 From<&[char]> for Utf32String

Source§

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

Converts to this type from the input type.
Source§

impl From<&Utf32Str> for Utf32String

Source§

fn from(value: &Utf32Str) -> Self

Converts to this type from the input type.
Source§

impl From<&Utf32String> for Utf32String

Source§

fn from(value: &Utf32String) -> Self

Converts to this type from the input type.
Source§

impl From<&mut Utf32Str> for Utf32String

Source§

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

Converts to this type from the input type.
Source§

impl From<&str> for Utf32String

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, Utf32Str>> for Utf32String

Source§

fn from(value: Cow<'_, Utf32Str>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Utf32String

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<char>> for Utf32String

Source§

fn from(value: Vec<char>) -> Self

Converts to this type from the input type.
Source§

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

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 char> for Utf32String

Source§

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

Creates a value from an iterator. Read more
Source§

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

Source§

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

Creates a value from an iterator. Read more
Source§

impl FromIterator<Box<Utf32Str>> for Utf32String

Source§

fn from_iter<T: IntoIterator<Item = Box<Utf32Str>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> FromIterator<Cow<'a, Utf32Str>> for Utf32String

Source§

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

Creates a value from an iterator. Read more
Source§

impl FromIterator<String> for Utf32String

Source§

fn from_iter<T: IntoIterator<Item = String>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Utf32String> for Utf32String

Source§

fn from_iter<T: IntoIterator<Item = Utf32String>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<char> for Utf32String

Source§

fn from_iter<T: IntoIterator<Item = char>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl FromStr for Utf32String

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Utf32String

Source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<I> Index<I> for Utf32String
where I: RangeBounds<usize> + SliceIndex<[u32], Output = [u32]>,

Source§

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 Utf32String
where I: RangeBounds<usize> + 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 Utf32String

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<&Utf16Str> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&Utf32Str> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&str> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<[char]> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<String> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<U32CStr> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<U32CString> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<U32Str> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<U32String> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Utf16String> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Utf32Str> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<str> for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Utf32String

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Utf32String

Source§

fn partial_cmp(&self, other: &Utf32String) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TryFrom<&[u32]> for Utf32String

Source§

type Error = Utf32Error

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

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

Performs the conversion.
Source§

impl TryFrom<&U32CStr> for Utf32String

Source§

type Error = Utf32Error

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

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

Performs the conversion.
Source§

impl TryFrom<&U32Str> for Utf32String

Source§

type Error = Utf32Error

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

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

Performs the conversion.
Source§

impl TryFrom<U32CString> for Utf32String

Source§

type Error = Utf32Error

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

fn try_from(value: U32CString) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<U32String> for Utf32String

Source§

type Error = Utf32Error

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

fn try_from(value: U32String) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Vec<u32>> for Utf32String

Source§

type Error = Utf32Error

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

fn try_from(value: Vec<u32>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Write for Utf32String

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
Source§

fn write_char(&mut self, c: char) -> Result

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl Eq for Utf32String

Source§

impl StructuralPartialEq for Utf32String