doc.rust-lang.org
pub type ParseError = core::convert::Infallible
A type alias for convert::InfallibleInfallible.
type_alias
alloc
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct String
A UTF-8–encoded, growable string.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_bytes(&self) -> &[u8]
Returns a byte slice of this String's contents.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_mut_str(&mut self) -> &mut str
Converts a String into a mutable string slice.
method
alloc
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8>
Returns a mutable reference to the contents of this String.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_str(&self) -> &str
Extracts a string slice containing the entire String.
method
alloc
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn capacity(&self) -> usize
Returns this String's capacity, in bytes.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn clear(&mut self)
Truncates this String, removing all contents.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn drain<R>(&mut self, range: R) -> Drain<'_>
Removes the specified range from the string in bulk, returning all removed characters as an iterator.
method
alloc
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn extend_from_within<R>(&mut self, src: R)
Copies elements from src range to the end of the string.
method
alloc
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_raw_parts(buf: *mut u8, length: usize, capacity: usize) -> String
Creates a new String from a pointer, a length and a capacity.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error>
Decode a native endian UTF-16–encoded vector v into a String, returning Err if v contains any invalid data.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf16_lossy(v: &[u16]) -> String
Decode a native endian UTF-16–encoded slice v into a String, replacing invalid data with the replacement character (U+FFFD).
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf16be(v: &[u8]) -> Result<String, FromUtf16Error>
Decode a UTF-16BE–encoded vector v into a String, returning Err if v contains any invalid data.
associated_function
alloc
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf16be_lossy(v: &[u8]) -> String
Decode a UTF-16BE–encoded slice v into a String, replacing invalid data with the replacement character (U+FFFD).
associated_function
alloc
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf16le(v: &[u8]) -> Result<String, FromUtf16Error>
Decode a UTF-16LE–encoded vector v into a String, returning Err if v contains any invalid data.
associated_function
alloc
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf16le_lossy(v: &[u8]) -> String
Decode a UTF-16LE–encoded slice v into a String, replacing invalid data with the replacement character (U+FFFD).
associated_function
alloc
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error>
Converts a vector of bytes to a String.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf8_lossy(v: &[u8]) -> Cow<'_, str>
Converts a slice of bytes to a string, including invalid characters.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_utf8_lossy_owned(v: Vec<u8>) -> String
Converts a Vec<u8> to a String, substituting invalid UTF-8 sequences with replacement characters.
associated_function
alloc
Stable since 1.100.0
Version 1.100.0-nightly