]> git.lizzy.rs Git - rust.git/blob - library/std/src/sys/wasm/mod.rs
Rollup merge of #103104 - SUPERCILEX:sep-ref, r=dtolnay
[rust.git] / library / std / src / sys / wasm / mod.rs
1 //! System bindings for the wasm/web platform
2 //!
3 //! This module contains the facade (aka platform-specific) implementations of
4 //! OS level functionality for wasm. Note that this wasm is *not* the emscripten
5 //! wasm, so we have no runtime here.
6 //!
7 //! This is all super highly experimental and not actually intended for
8 //! wide/production use yet, it's still all in the experimental category. This
9 //! will likely change over time.
10 //!
11 //! Currently all functions here are basically stubs that immediately return
12 //! errors. The hope is that with a portability lint we can turn actually just
13 //! remove all this and just omit parts of the standard library if we're
14 //! compiling for wasm. That way it's a compile time error for something that's
15 //! guaranteed to be a runtime error!
16
17 #![deny(unsafe_op_in_unsafe_fn)]
18
19 pub mod alloc;
20 #[path = "../unsupported/args.rs"]
21 pub mod args;
22 #[path = "../unix/cmath.rs"]
23 pub mod cmath;
24 pub mod env;
25 #[path = "../unsupported/fs.rs"]
26 pub mod fs;
27 #[path = "../unsupported/io.rs"]
28 pub mod io;
29 #[path = "../unsupported/net.rs"]
30 pub mod net;
31 #[path = "../unsupported/os.rs"]
32 pub mod os;
33 #[path = "../unix/os_str.rs"]
34 pub mod os_str;
35 #[path = "../unix/path.rs"]
36 pub mod path;
37 #[path = "../unsupported/pipe.rs"]
38 pub mod pipe;
39 #[path = "../unsupported/process.rs"]
40 pub mod process;
41 #[path = "../unsupported/stdio.rs"]
42 pub mod stdio;
43 #[path = "../unsupported/thread_local_dtor.rs"]
44 pub mod thread_local_dtor;
45 #[path = "../unsupported/thread_local_key.rs"]
46 pub mod thread_local_key;
47 #[path = "../unsupported/time.rs"]
48 pub mod time;
49
50 cfg_if::cfg_if! {
51     if #[cfg(target_feature = "atomics")] {
52         #[path = "../unix/locks"]
53         pub mod locks {
54             #![allow(unsafe_op_in_unsafe_fn)]
55             mod futex_condvar;
56             mod futex_mutex;
57             mod futex_rwlock;
58             pub(crate) use futex_condvar::Condvar;
59             pub(crate) use futex_mutex::Mutex;
60             pub(crate) use futex_rwlock::RwLock;
61         }
62         #[path = "atomics/futex.rs"]
63         pub mod futex;
64         #[path = "atomics/thread.rs"]
65         pub mod thread;
66     } else {
67         #[path = "../unsupported/locks/mod.rs"]
68         pub mod locks;
69         #[path = "../unsupported/once.rs"]
70         pub mod once;
71         #[path = "../unsupported/thread.rs"]
72         pub mod thread;
73     }
74 }
75
76 #[path = "../unsupported/common.rs"]
77 #[deny(unsafe_op_in_unsafe_fn)]
78 mod common;
79 pub use common::*;