File tree Expand file tree Collapse file tree 4 files changed +54
-1
lines changed Expand file tree Collapse file tree 4 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ cfg_if::cfg_if! {
2424 // If we're not documenting libstd then we just expose the main modules
2525 // as we otherwise would.
2626
27- #[ cfg( any( target_os = "redox" , unix, target_os = "vxworks" ) ) ]
27+ #[ cfg( any( target_os = "redox" , unix, target_os = "vxworks" , target_os = "hermit" ) ) ]
2828 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2929 pub use crate :: sys:: ext as unix;
3030
Original file line number Diff line number Diff line change 1+ //! HermitCore-specific extension to the primitives in the `std::ffi` module
2+ //!
3+ //! # Examples
4+ //!
5+ //! ```
6+ //! use std::ffi::OsString;
7+ //! use std::os::hermit::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::hermit::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+ #![ stable( feature = "rust1" , since = "1.0.0" ) ]
36+
37+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
38+ pub use crate :: sys_common:: os_str_bytes:: * ;
Original file line number Diff line number Diff line change 1+ #![ stable( feature = "rust1" , since = "1.0.0" ) ]
2+ #![ allow( missing_docs) ]
3+
4+ pub mod ffi;
5+
6+ /// A prelude for conveniently writing platform-specific code.
7+ ///
8+ /// Includes all extension traits, and some important type definitions.
9+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
10+ pub mod prelude {
11+ #[ doc( no_inline) ]
12+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
13+ pub use super :: ffi:: { OsStrExt , OsStringExt } ;
14+ }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ pub mod args;
2121pub mod cmath;
2222pub mod condvar;
2323pub mod env;
24+ pub mod ext;
2425pub mod fast_thread_local;
2526pub mod fd;
2627pub mod fs;
You can’t perform that action at this time.
0 commit comments