1//! Unix-specific extensions to primitives in the [`std::ffi`] module.
2//!
3//! # Examples
4//!
5//! ```
6//! use std::ffi::OsString;
7//! use std::os::unix::ffi::OsStringExt;
8//!
9//! let bytes = b"foo".to_vec();
10//!
11//! // OsStringExt::from_vec
12//! let os_string = OsString::from_vec(bytes);
13//! assert_eq!(os_string.to_str(), Some("foo"));
14//!
15//! // OsStringExt::into_vec
16//! let bytes = os_string.into_vec();
17//! assert_eq!(bytes, b"foo");
18//! ```
19//!
20//! ```
21//! use std::ffi::OsStr;
22//! use std::os::unix::ffi::OsStrExt;
23//!
24//! let bytes = b"foo";
25//!
26//! // OsStrExt::from_bytes
27//! let os_str = OsStr::from_bytes(bytes);
28//! assert_eq!(os_str.to_str(), Some("foo"));
29//!
30//! // OsStrExt::as_bytes
31//! let bytes = os_str.as_bytes();
32//! assert_eq!(bytes, b"foo");
33//! ```
34//!
35//! [`std::ffi`]: crate::ffi
36
37#![stable(feature = "rust1", since = "1.0.0")]
38
39mod os_str;
40
41#[stable(feature = "rust1", since = "1.0.0")]
42pub use self::os_str::{OsStrExt, OsStringExt};
43