[][src]Struct sgx_tstd::ffi::OsString

pub struct OsString { /* fields omitted */ }

A type that can represent owned, mutable platform-native strings, but is cheaply inter-convertible with Rust strings.

Methods

impl OsString[src]

pub fn new() -> OsString[src]

Constructs a new empty OsString.

pub fn as_os_str(&self) -> &OsStr[src]

Converts to an OsStr slice.

pub fn into_string(self) -> Result<String, OsString>[src]

Converts the OsString into a String if it contains valid Unicode data.

On failure, ownership of the original OsString is returned.

pub fn push<T: AsRef<OsStr>>(&mut self, s: T)[src]

Extends the string with the given &OsStr slice.

pub fn with_capacity(capacity: usize) -> OsString[src]

Creates a new OsString with the given capacity.

The string will be able to hold exactly capacity length units of other OS strings without reallocating. If capacity is 0, the string will not allocate.

See main OsString documentation information about encoding.

pub fn clear(&mut self)[src]

Truncates the OsString to zero length.

pub fn capacity(&self) -> usize[src]

Returns the capacity this OsString can hold without reallocating.

See OsString introduction for information about encoding.

pub fn reserve(&mut self, additional: usize)[src]

Reserves capacity for at least additional more capacity to be inserted in the given OsString.

The collection may reserve more space to avoid frequent reallocations.

pub fn reserve_exact(&mut self, additional: usize)[src]

Reserves the minimum capacity for exactly additional more capacity to be inserted in the given OsString. Does nothing if the capacity is already sufficient.

Note that the allocator may give the collection more space than it requests. Therefore, capacity can not be relied upon to be precisely minimal. Prefer reserve if future insertions are expected.

pub fn shrink_to_fit(&mut self)[src]

Shrinks the capacity of the OsString to match its length.

pub fn shrink_to(&mut self, min_capacity: usize)[src]

Shrinks the capacity of the OsString with a lower bound.

The capacity will remain at least as large as both the length and the supplied value.

Panics if the current capacity is smaller than the supplied minimum capacity.

pub fn into_boxed_os_str(self) -> Box<OsStr>[src]

Converts this OsString into a boxed OsStr.

Methods from Deref<Target = OsStr>

pub fn to_str(&self) -> Option<&str>[src]

Yields a &str slice if the OsStr is valid Unicode.

This conversion may entail doing a check for UTF-8 validity.

pub fn to_string_lossy(&self) -> Cow<str>[src]

Converts an OsStr to a Cow<str>.

Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.

pub fn to_os_string(&self) -> OsString[src]

Copies the slice into an owned OsString.

pub fn is_empty(&self) -> bool[src]

Checks whether the OsStr is empty.

pub fn len(&self) -> usize[src]

Returns the length of this OsStr.

Note that this does not return the number of bytes in the string in OS string form.

The length returned is that of the underlying storage used by OsStr. As discussed in the OsString introduction, OsString and OsStr store strings in a form best suited for cheap inter-conversion between native-platform and Rust string forms, which may differ significantly from both of them, including in storage size and encoding.

This number is simply useful for passing to other methods, like OsString::with_capacity to avoid reallocations.

pub fn make_ascii_lowercase(&mut self)[src]

Converts this string to its ASCII lower case equivalent in-place.

ASCII letters 'A' to 'Z' are mapped to 'a' to 'z', but non-ASCII letters are unchanged.

To return a new lowercased value without modifying the existing one, use to_ascii_lowercase.

pub fn make_ascii_uppercase(&mut self)[src]

Converts this string to its ASCII upper case equivalent in-place.

ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', but non-ASCII letters are unchanged.

To return a new uppercased value without modifying the existing one, use to_ascii_uppercase.

pub fn to_ascii_lowercase(&self) -> OsString[src]

Returns a copy of this string where each character is mapped to its ASCII lower case equivalent.

ASCII letters 'A' to 'Z' are mapped to 'a' to 'z', but non-ASCII letters are unchanged.

To lowercase the value in-place, use make_ascii_lowercase.

pub fn to_ascii_uppercase(&self) -> OsString[src]

Returns a copy of this string where each character is mapped to its ASCII upper case equivalent.

ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', but non-ASCII letters are unchanged.

To uppercase the value in-place, use make_ascii_uppercase.

pub fn is_ascii(&self) -> bool[src]

Checks if all characters in this string are within the ASCII range.

pub fn eq_ignore_ascii_case<S: ?Sized + AsRef<OsStr>>(&self, other: &S) -> bool[src]

Checks that two strings are an ASCII case-insensitive match.

Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), but without allocating and copying temporaries.

Trait Implementations

impl AsRef<OsStr> for OsString[src]

impl AsRef<Path> for OsString[src]

impl Borrow<OsStr> for OsString[src]

impl Clone for OsString[src]

impl Debug for OsString[src]

impl Default for OsString[src]

fn default() -> OsString[src]

Constructs an empty OsString.

impl Deref for OsString[src]

type Target = OsStr

The resulting type after dereferencing.

impl DerefMut for OsString[src]

impl Eq for OsString[src]

impl<'_, T: ?Sized + AsRef<OsStr>> From<&'_ T> for OsString[src]

impl<'a> From<&'a OsString> for Cow<'a, OsStr>[src]

impl From<Box<OsStr>> for OsString[src]

fn from(boxed: Box<OsStr>) -> OsString[src]

Converts a Box<OsStr> into a OsString without copying or allocating.

impl<'a> From<Cow<'a, OsStr>> for OsString[src]

impl From<OsString> for Box<OsStr>[src]

fn from(s: OsString) -> Box<OsStr>[src]

Converts a OsString into a Box<OsStr> without copying or allocating.

impl From<OsString> for Arc<OsStr>[src]

fn from(s: OsString) -> Arc<OsStr>[src]

Converts a OsString into a Arc<OsStr> without copying or allocating.

impl From<OsString> for Rc<OsStr>[src]

fn from(s: OsString) -> Rc<OsStr>[src]

Converts a OsString into a Rc<OsStr> without copying or allocating.

impl<'a> From<OsString> for Cow<'a, OsStr>[src]

impl From<OsString> for PathBuf[src]

fn from(s: OsString) -> PathBuf[src]

Converts a OsString into a PathBuf

This conversion does not allocate or copy memory.

impl From<PathBuf> for OsString[src]

fn from(path_buf: PathBuf) -> OsString[src]

Converts a PathBuf into a OsString

This conversion does not allocate or copy memory.

impl From<String> for OsString[src]

fn from(s: String) -> OsString[src]

Converts a String into a OsString.

The conversion copies the data, and includes an allocation on the heap.

impl Hash for OsString[src]

impl Index<RangeFull> for OsString[src]

type Output = OsStr

The returned type after indexing.

impl IndexMut<RangeFull> for OsString[src]

impl Ord for OsString[src]

impl OsStringExt for OsString[src]

impl<'_> PartialEq<&'_ str> for OsString[src]

impl<'a, 'b> PartialEq<&'a OsStr> for OsString[src]

impl<'a, 'b> PartialEq<&'a Path> for OsString[src]

impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for OsString[src]

impl<'a, 'b> PartialEq<Cow<'a, Path>> for OsString[src]

impl<'a, 'b> PartialEq<OsStr> for OsString[src]

impl PartialEq<OsString> for OsString[src]

impl PartialEq<OsString> for str[src]

impl<'a> PartialEq<OsString> for &'a str[src]

impl<'a, 'b> PartialEq<OsString> for OsStr[src]

impl<'a, 'b> PartialEq<OsString> for &'a OsStr[src]

impl<'a, 'b> PartialEq<OsString> for Cow<'a, OsStr>[src]

impl<'a, 'b> PartialEq<OsString> for PathBuf[src]

impl<'a, 'b> PartialEq<OsString> for Path[src]

impl<'a, 'b> PartialEq<OsString> for &'a Path[src]

impl<'a, 'b> PartialEq<OsString> for Cow<'a, Path>[src]

impl<'a, 'b> PartialEq<Path> for OsString[src]

impl<'a, 'b> PartialEq<PathBuf> for OsString[src]

impl PartialEq<str> for OsString[src]

impl<'a, 'b> PartialOrd<&'a OsStr> for OsString[src]

impl<'a, 'b> PartialOrd<&'a Path> for OsString[src]

impl<'a, 'b> PartialOrd<Cow<'a, OsStr>> for OsString[src]

impl<'a, 'b> PartialOrd<Cow<'a, Path>> for OsString[src]

impl<'a, 'b> PartialOrd<OsStr> for OsString[src]

impl PartialOrd<OsString> for OsString[src]

impl<'a, 'b> PartialOrd<OsString> for OsStr[src]

impl<'a, 'b> PartialOrd<OsString> for &'a OsStr[src]

impl<'a, 'b> PartialOrd<OsString> for Cow<'a, OsStr>[src]

impl<'a, 'b> PartialOrd<OsString> for PathBuf[src]

impl<'a, 'b> PartialOrd<OsString> for Path[src]

impl<'a, 'b> PartialOrd<OsString> for &'a Path[src]

impl<'a, 'b> PartialOrd<OsString> for Cow<'a, Path>[src]

impl<'a, 'b> PartialOrd<Path> for OsString[src]

impl<'a, 'b> PartialOrd<PathBuf> for OsString[src]

impl PartialOrd<str> for OsString[src]

Auto Trait Implementations

impl RefUnwindSafe for OsString

impl Send for OsString

impl Sync for OsString

impl Unpin for OsString

impl UnwindSafe for OsString

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.