[IO] Move io module into selected re-exports

In the coming commits we'll move our `io` module to having its own
implementations of the usual I/O traits and structs. Here we first
move to re-exporting only exactly what we need, allowing us to
whittle the list down from a fixed set.
This commit is contained in:
Matt Corallo 2023-09-09 23:31:48 +00:00
parent 27c7c4e26a
commit a0ade883b6
1 changed files with 18 additions and 5 deletions

View File

@ -21,12 +21,25 @@
#[cfg(all(not(feature = "std"), not(feature = "core2")))]
compile_error!("At least one of std or core2 must be enabled");
#[cfg(feature = "std")]
pub use std::io;
#[cfg(feature = "std")]
pub use std::error;
#[cfg(not(feature = "std"))]
pub use core2::io;
#[cfg(not(feature = "std"))]
pub use core2::error;
#[cfg(any(feature = "alloc", feature = "std"))]
extern crate alloc;
/// Standard I/O stream definitions which are API-equivalent to `std`'s `io` module. See
/// [`std::io`] for more info.
pub mod io {
#[cfg(all(not(feature = "std"), not(feature = "core2")))]
compile_error!("At least one of std or core2 must be enabled");
#[cfg(feature = "std")]
pub use std::io::{Read, Write, Cursor, Take, IoSlice, Error, ErrorKind, Result};
#[cfg(not(feature = "std"))]
pub use core2::io::{Read, Write, Cursor, Take, Error, ErrorKind, Result};
}