doc.rust-lang.org
primitive fn
Function pointers, like fn(usize) -> bool.
primitive
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn with_capacity(capacity: usize) -> OsString
Creates a new OsString with at least the given capacity.
associated_function
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve the minimum capacity for at least additional more length units in the given OsString. After calling try_reserve_exact, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if the capacity is already sufficient.
method
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve capacity for at least additional more length units in the given OsString. The string may reserve more space to speculatively avoid frequent reallocations. After calling try_reserve, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if capacity is already sufficient. This method preserves the contents even if an error occurs.
method
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the OsString to match its length.
method
std
Stable since 1.19.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to(&mut self, min_capacity: usize)
Shrinks the capacity of the OsString with a lower bound.
method
std
Stable since 1.56.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for at least additional more capacity to be inserted in the given OsString. Does nothing if the capacity is already sufficient.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more capacity to be inserted in the given OsString. Does nothing if the capacity is already sufficient.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn push<T>(&mut self, s: T)
Extends the string with the given &OsStr slice.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> OsString
Constructs a new empty OsString.
associated_function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn leak<'a>(self) -> &'a mut OsStr
Consumes and leaks the OsString, returning a mutable reference to the contents, &'a mut OsStr.
method
std
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_string(self) -> Result<String, OsString>
Converts the OsString into a String if it contains valid Unicode data.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_encoded_bytes(self) -> Vec<u8>
Converts the OsString into a byte vector. To convert the byte vector back into an OsString, use the OsString::from_encoded_bytes_unchecked function.
method
std
Stable since 1.74.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_boxed_os_str(self) -> Box<OsStr>
Converts this OsString into a boxed OsStr.
method
std
Stable since 1.20.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_encoded_bytes_unchecked(bytes: Vec<u8>) -> Self
Converts bytes to an OsString without checking that the bytes contains valid OsStr-encoded data.
associated_function
std
Stable since 1.74.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn clear(&mut self)
Truncates the OsString to zero length.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn capacity(&self) -> usize
Returns the capacity this OsString can hold without reallocating.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_os_str(&self) -> &OsStr
Converts to an OsStr slice.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct OsString
A type that can represent owned, mutable platform-native strings, but is cheaply inter-convertible with Rust strings.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn to_string_lossy(&self) -> Cow<'_, str>
Converts an OsStr to a Cow<str>.
method
std
Stable since 1.0.0
Version 1.100.0-nightly