doc.rust-lang.org
pub fn to_str(&self) -> Option<&str>
Yields a &str slice if the OsStr is valid Unicode.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn to_os_string(&self) -> OsString
Copies the slice into an owned OsString.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn to_ascii_uppercase(&self) -> OsString
Returns a copy of this string where each character is mapped to its ASCII upper case equivalent.
method
std
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn to_ascii_lowercase(&self) -> OsString
Returns a copy of this string where each character is mapped to its ASCII lower case equivalent.
method
std
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new<S>(s: &S) -> &OsStr
Coerces into an OsStr slice.
associated_function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn make_ascii_uppercase(&mut self)
Converts this string to its ASCII upper case equivalent in-place.
method
std
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn make_ascii_lowercase(&mut self)
Converts this string to its ASCII lower case equivalent in-place.
method
std
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn len(&self) -> usize
Returns the length of this OsStr.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_empty(&self) -> bool
Checks whether the OsStr is empty.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_ascii(&self) -> bool
Checks if all characters in this string are within the ASCII range.
method
std
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_os_string(self: Box<Self>) -> OsString
Converts a Box<OsStr> into an OsString without copying or allocating.
method
std
Stable since 1.20.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_encoded_bytes_unchecked(bytes: &[u8]) -> &Self
Converts a slice of bytes to an OS string slice without checking that the string contains valid OsStr-encoded data.
associated_function
std
Stable since 1.74.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn eq_ignore_ascii_case<S>(&self, other: S) -> bool
Checks that two strings are an ASCII case-insensitive match.
method
std
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn display(&self) -> Display<'_>
Returns an object that implements Display for safely printing an OsStr that may contain non-Unicode data. This may perform lossy conversion, depending on the platform. If you would like an implementation which escapes the OsStr please use Debug instead.
method
std
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_encoded_bytes(&self) -> &[u8]
Converts an OS string slice to a byte slice. To convert the byte slice back into an OS string slice, use the OsStr::from_encoded_bytes_unchecked function.
method
std
Stable since 1.74.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct OsStr
Borrowed reference to an OS string (see OsString).
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Display<'a>
Helper struct for safely printing an OsStr with format! and {}.
struct
std
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod os_str
The OsStr and OsString types and associated utilities.
module
std
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod c_str
CStr, CString, and related types.
module
std
Stable since 1.88.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod ffi
Utilities related to FFI bindings.
module
std
Stable since 1.0.0
Version 1.100.0-nightly