Expand description
A UTF-8–encoded, growable string.
This module contains the String type, the ToString trait for
converting to strings, and several error types that may result from
working with Strings.
§Examples
There are multiple ways to create a new String from a string literal:
You can create a new String from an existing one by concatenating with
+:
If you have a vector of valid UTF-8 bytes, you can make a String out of
it. You can do the reverse too.
Re-exports§
use core::ascii;🔒use core::error::Error;🔒use core::iter::FusedIterator;🔒use core::iter::from_fn;🔒use core::mem::MaybeUninit;🔒use core::num::Saturating;🔒use core::ops::Add;🔒use core::ops::AddAssign;🔒use core::ops;🔒use core::ops::Range;🔒use core::ops::RangeBounds;🔒use core::str::pattern::Pattern;🔒Experimental use core::str::pattern::Utf8Pattern;🔒Experimental use core::fmt;🔒use core::hash;🔒use core::ptr;🔒use core::slice;🔒use crate::alloc::Allocator;🔒use crate::borrow::Cow;🔒use crate::borrow::ToOwned;🔒use crate::boxed::Box;🔒use crate::collections::TryReserveError;🔒use crate::str;🔒use crate::str::CharIndices;🔒use crate::str::Chars;🔒use crate::str::Utf8Error;🔒use crate::str::from_utf8_unchecked_mut;🔒use crate::str::FromStr;🔒use crate::str::from_boxed_utf8_unchecked;🔒use crate::vec;🔒use crate::vec::Vec;🔒
Macros§
Structs§
- Drain
- A draining iterator for
String. - From
Utf8 Error - A possible error value when converting a
Stringfrom a UTF-8 byte vector. - From
Utf16 Error - A possible error value when converting a
Stringfrom a UTF-16 byte slice. - Into
Chars - An iterator over the
chars of a string. - String
- A UTF-8–encoded, growable string.
Enums§
Traits§
- From
Char 🔒Iter Spec - Spec
Extend 🔒Chars - Spec
Extend 🔒Str - Spec
ToString 🔒 - ToString
- A trait for converting a value to a
String.
Functions§
Type Aliases§
- Parse
Error - A type alias for
!.