xref: /drstd/src/std/os/solid/ffi.rs (revision 86982c5e9b2eaa583327251616ee822c36288824)
1 //! SOLID-specific extension to the primitives in the `std::ffi` module
2 //!
3 //! # Examples
4 //!
5 //! ```
6 //! use std::ffi::OsString;
7 //! use std::os::solid::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::solid::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 #[path = "../unix/ffi/os_str.rs"]
36 mod os_str;
37 
38 pub use self::os_str::{OsStrExt, OsStringExt};
39