doc.rust-lang.org
pub fn leak<'a>(self) -> &'a mut str
Consumes and leaks the String, returning a mutable reference to the contents, &'a mut str.
method
alloc
Stable since 1.72.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_empty(&self) -> bool
Returns true if this String has a length of zero, and false otherwise.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_raw_parts(self) -> (*mut u8, usize, usize)
Decomposes a String into its raw components: (pointer, length, capacity).
method
alloc
Stable since 1.93.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn into_bytes(self) -> Vec<u8>
Converts a String into a byte vector.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_boxed_str(self) -> Box<str>
Converts this String into a Box<strstr>.
method
alloc
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert_str(&mut self, idx: usize, string: &str)
Inserts a string slice into this String at byte position idx.
method
alloc
Stable since 1.16.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert(&mut self, idx: usize, ch: char)
Inserts a character into this String at byte position idx.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String
Converts a vector of bytes to a String without checking that the string contains valid UTF-8.
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
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(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_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_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_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_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_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_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 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 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 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