about summary refs log tree commit diff
path: root/library/std/src/sys/io/mod.rs
blob: fe8ec1dbb7325396e0deeca283ad33f3ff2bf161 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#![forbid(unsafe_op_in_unsafe_fn)]

mod io_slice {
    cfg_select! {
        any(target_family = "unix", target_os = "hermit", target_os = "solid_asp3", target_os = "trusty") => {
            mod iovec;
            pub use iovec::*;
        }
        target_os = "windows" => {
            mod windows;
            pub use windows::*;
        }
        target_os = "wasi" => {
            mod wasi;
            pub use wasi::*;
        }
        target_os = "uefi" => {
            mod uefi;
            pub use uefi::*;
        }
        _ => {
            mod unsupported;
            pub use unsupported::*;
        }
    }
}

mod is_terminal {
    cfg_select! {
        any(target_family = "unix", target_os = "wasi") => {
            mod isatty;
            pub use isatty::*;
        }
        target_os = "windows" => {
            mod windows;
            pub use windows::*;
        }
        target_os = "hermit" => {
            mod hermit;
            pub use hermit::*;
        }
        _ => {
            mod unsupported;
            pub use unsupported::*;
        }
    }
}

pub use io_slice::{IoSlice, IoSliceMut};
pub use is_terminal::is_terminal;

// Bare metal platforms usually have very small amounts of RAM
// (in the order of hundreds of KB)
pub const DEFAULT_BUF_SIZE: usize = if cfg!(target_os = "espidf") { 512 } else { 8 * 1024 };