| 1 | #![forbid (unsafe_op_in_unsafe_fn)] |
| 2 | |
| 3 | mod io_slice { |
| 4 | cfg_if::cfg_if! { |
| 5 | if #[cfg(any(target_family = "unix" , target_os = "hermit" , target_os = "solid_asp3" , target_os = "trusty" ))] { |
| 6 | mod iovec; |
| 7 | pub use iovec::*; |
| 8 | } else if #[cfg(target_os = "windows" )] { |
| 9 | mod windows; |
| 10 | pub use windows::*; |
| 11 | } else if #[cfg(target_os = "wasi" )] { |
| 12 | mod wasi; |
| 13 | pub use wasi::*; |
| 14 | } else { |
| 15 | mod unsupported; |
| 16 | pub use unsupported::*; |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | mod is_terminal { |
| 22 | cfg_if::cfg_if! { |
| 23 | if #[cfg(any(target_family = "unix" , target_os = "wasi" ))] { |
| 24 | mod isatty; |
| 25 | pub use isatty::*; |
| 26 | } else if #[cfg(target_os = "windows" )] { |
| 27 | mod windows; |
| 28 | pub use windows::*; |
| 29 | } else if #[cfg(target_os = "hermit" )] { |
| 30 | mod hermit; |
| 31 | pub use hermit::*; |
| 32 | } else { |
| 33 | mod unsupported; |
| 34 | pub use unsupported::*; |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | pub use io_slice::{IoSlice, IoSliceMut}; |
| 40 | pub use is_terminal::is_terminal; |
| 41 | |
| 42 | // Bare metal platforms usually have very small amounts of RAM |
| 43 | // (in the order of hundreds of KB) |
| 44 | pub const DEFAULT_BUF_SIZE: usize = if cfg!(target_os = "espidf" ) { 512 } else { 8 * 1024 }; |
| 45 | |