Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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 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 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 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_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 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 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 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 fn utf8_error(&self) -> Utf8Error
Fetch a Utf8Error to get more details about the conversion failure.
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_utf8_lossy(self) -> String
Converts the bytes into a String lossily, substituting invalid UTF-8 sequences with replacement characters.
method alloc Stable since 1.100.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_bytes(self) -> Vec<u8>
Returns the bytes that were attempted to convert to a String.
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_bytes(&self) -> &[u8]
Returns a slice of u8s bytes that were attempted to convert to a String.
method alloc Stable since 1.26.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct FromUtf8Error
A possible error value when converting a String from a UTF-8 byte vector.
struct alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct FromUtf16Error
A possible error value when converting a String from a UTF-16 byte slice.
struct alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_str(&self) -> &str
Returns the remaining (sub)string of this iterator as a slice.
method alloc Stable since 1.55.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct Drain<'a>
A draining iterator for String.
struct alloc Stable since 1.6.0 Version 1.100.0-nightly
doc.rust-lang.org
pub mod string
A UTF-8–encoded, growable string.
module alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_boxed_utf8_unchecked(v: crate::boxed::Box<[u8]>) -> crate::boxed::Box<str>
Converts a boxed slice of bytes to a boxed string slice without checking that the string contains valid UTF-8.
function alloc Stable since 1.20.0 Version 1.100.0-nightly
doc.rust-lang.org
pub mod str
Utilities for the str primitive type.
module alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub mod slice
Utilities for the slice primitive type.
module alloc Stable since 1.0.0 Version 1.100.0-nightly
"As an expert at being ignorant of what `Pin` does, I can assert with expertise that other ignorant readers have a hard time with `Pin`."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.