| 1 | #![forbid (unsafe_op_in_unsafe_fn)] |
| 2 | |
| 3 | mod error; |
| 4 | |
| 5 | mod io_slice { |
| 6 | cfg_select! { |
| 7 | any(target_family = "unix" , target_os = "hermit" , target_os = "solid_asp3" , target_os = "trusty" , target_os = "wasi" ) => { |
| 8 | mod iovec; |
| 9 | pub use iovec::*; |
| 10 | } |
| 11 | target_os = "windows" => { |
| 12 | mod windows; |
| 13 | pub use windows::*; |
| 14 | } |
| 15 | target_os = "uefi" => { |
| 16 | mod uefi; |
| 17 | pub use uefi::*; |
| 18 | } |
| 19 | _ => { |
| 20 | mod unsupported; |
| 21 | pub use unsupported::*; |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | mod is_terminal { |
| 27 | cfg_select! { |
| 28 | any(target_family = "unix" , target_os = "wasi" ) => { |
| 29 | mod isatty; |
| 30 | pub use isatty::*; |
| 31 | } |
| 32 | target_os = "windows" => { |
| 33 | mod windows; |
| 34 | pub use windows::*; |
| 35 | } |
| 36 | target_os = "hermit" => { |
| 37 | mod hermit; |
| 38 | pub use hermit::*; |
| 39 | } |
| 40 | target_os = "motor" => { |
| 41 | mod motor; |
| 42 | pub use motor::*; |
| 43 | } |
| 44 | _ => { |
| 45 | mod unsupported; |
| 46 | pub use unsupported::*; |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | mod kernel_copy; |
| 52 | |
| 53 | #[cfg_attr (not(target_os = "linux" ), allow(unused_imports))] |
| 54 | #[cfg (all( |
| 55 | target_family = "unix" , |
| 56 | not(any(target_os = "dragonfly" , target_os = "vxworks" , target_os = "rtems" )) |
| 57 | ))] |
| 58 | pub use error::errno_location; |
| 59 | #[cfg_attr (not(target_os = "linux" ), allow(unused_imports))] |
| 60 | #[cfg (any( |
| 61 | all(target_family = "unix" , not(any(target_os = "vxworks" , target_os = "rtems" ))), |
| 62 | target_os = "wasi" , |
| 63 | ))] |
| 64 | pub use error::set_errno; |
| 65 | pub use error::{RawOsError, decode_error_kind, errno, error_string, is_interrupted}; |
| 66 | pub use io_slice::{IoSlice, IoSliceMut}; |
| 67 | pub use is_terminal::is_terminal; |
| 68 | pub use kernel_copy::{CopyState, kernel_copy}; |
| 69 | |
| 70 | // Bare metal platforms usually have very small amounts of RAM |
| 71 | // (in the order of hundreds of KB) |
| 72 | pub const DEFAULT_BUF_SIZE: usize = if cfg!(target_os = "espidf" ) { 512 } else { 8 * 1024 }; |
| 73 | |