]>
git.proxmox.com Git - rustc.git/blob - src/libstd/sys/hermit/ext/ffi.rs
1 //! HermitCore-specific extension to the primitives in the `std::ffi` module
6 //! use std::ffi::OsString;
7 //! use std::os::hermit::ffi::OsStringExt;
9 //! let bytes = b"foo".to_vec();
11 //! // OsStringExt::from_vec
12 //! let os_string = OsString::from_vec(bytes);
13 //! assert_eq!(os_string.to_str(), Some("foo"));
15 //! // OsStringExt::into_vec
16 //! let bytes = os_string.into_vec();
17 //! assert_eq!(bytes, b"foo");
21 //! use std::ffi::OsStr;
22 //! use std::os::hermit::ffi::OsStrExt;
24 //! let bytes = b"foo";
26 //! // OsStrExt::from_bytes
27 //! let os_str = OsStr::from_bytes(bytes);
28 //! assert_eq!(os_str.to_str(), Some("foo"));
30 //! // OsStrExt::as_bytes
31 //! let bytes = os_str.as_bytes();
32 //! assert_eq!(bytes, b"foo");
35 #![stable(feature = "rust1", since = "1.0.0")]
37 #[stable(feature = "rust1", since = "1.0.0")]
38 pub use crate::sys_common
::os_str_bytes
::*;