# Trait std::os::unix::ffi::OsStrExt

1.0.0 · source ·

    pub trait OsStrExt: Sealed {
        // Required methods
        fn from_bytes(slice: &[u8]) -> &Self;
        fn as_bytes(&self) -> &[u8] ⓘ;
    }

Available on Unix only.
Expand description

Platform-specific extensions to `OsStr`.

This trait is sealed: it cannot be implemented outside the standard library. This is so that future additional methods are not breaking changes.

## Required Methods§

source

#### fn from_bytes(slice: &[u8]) -> &Self

Creates an `OsStr` from a byte slice.

See the module documentation for an example.

source

#### fn as_bytes(&self) -> &[u8] ⓘ

Gets the underlying byte view of the `OsStr` slice.

See the module documentation for an example.

## Object Safety§

This trait is not object safe.

## Implementors§

source§

### impl OsStrExt for OsStr