File tree 4 files changed +54
-1
lines changed
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! {
24
24
// If we're not documenting libstd then we just expose the main modules
25
25
// as we otherwise would.
26
26
27
- #[ cfg( any( target_os = "redox" , unix, target_os = "vxworks" ) ) ]
27
+ #[ cfg( any( target_os = "redox" , unix, target_os = "vxworks" , target_os = "hermit" ) ) ]
28
28
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
29
29
pub use crate :: sys:: ext as unix;
30
30
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;
21
21
pub mod cmath;
22
22
pub mod condvar;
23
23
pub mod env;
24
+ pub mod ext;
24
25
pub mod fast_thread_local;
25
26
pub mod fd;
26
27
pub mod fs;
You can’t perform that action at this time.
0 commit comments