Skip to main content

std/sys/io/
mod.rs

1#![forbid(unsafe_op_in_unsafe_fn)]
2
3mod error;
4
5mod is_terminal {
6    cfg_select! {
7        any(target_family = "unix", target_os = "wasi") => {
8            mod isatty;
9            pub use isatty::*;
10        }
11        target_os = "windows" => {
12            mod windows;
13            pub use windows::*;
14        }
15        target_os = "hermit" => {
16            mod hermit;
17            pub use hermit::*;
18        }
19        target_os = "motor" => {
20            mod motor;
21            pub use motor::*;
22        }
23        _ => {
24            mod unsupported;
25            pub use unsupported::*;
26        }
27    }
28}
29
30mod kernel_copy;
31
32#[cfg_attr(not(target_os = "linux"), allow(unused_imports))]
33#[cfg(all(
34    target_family = "unix",
35    not(any(target_os = "dragonfly", target_os = "vxworks", target_os = "rtems"))
36))]
37pub use error::errno_location;
38#[cfg_attr(not(target_os = "linux"), allow(unused_imports))]
39#[cfg(any(
40    all(target_family = "unix", not(any(target_os = "vxworks", target_os = "rtems"))),
41    target_os = "wasi",
42))]
43pub use error::set_errno;
44pub use error::{decode_error_kind, errno, error_string, is_interrupted};
45pub use is_terminal::is_terminal;
46pub use kernel_copy::{CopyState, kernel_copy};
47
48// Bare metal platforms usually have very small amounts of RAM
49// (in the order of hundreds of KB)
50pub const DEFAULT_BUF_SIZE: usize = if cfg!(target_os = "espidf") { 512 } else { 8 * 1024 };