Skip to content

Commit 4db9ba9

Browse files
committed
Reorganize some code and add comments.
1 parent ff9de45 commit 4db9ba9

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/ffi/mod.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
//! Utilities related to FFI bindings.
22
3-
#[cfg(not(feature = "std"))]
4-
pub use alloc::ffi::{CString, NulError};
5-
#[cfg(not(feature = "std"))]
6-
pub use core::ffi::{c_char, CStr, FromBytesWithNulError};
7-
3+
// If we have std, use it.
84
#[cfg(feature = "std")]
9-
pub use std::ffi::{CStr, CString, FromBytesWithNulError, NulError};
10-
#[cfg(feature = "std")]
11-
pub use std::os::raw::c_char;
5+
pub use {
6+
std::ffi::{CStr, CString, FromBytesWithNulError, NulError},
7+
std::os::raw::c_char,
8+
};
9+
10+
// If we don't have std, we can depend on core and alloc having these features
11+
// in new versions of Rust.
12+
#[cfg(not(feature = "std"))]
13+
pub use {
14+
alloc::ffi::{CString, NulError},
15+
core::ffi::{c_char, CStr, FromBytesWithNulError},
16+
};

0 commit comments

Comments
 (0)