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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use crate::os::raw::c_char;
pub mod alloc;
pub mod args;
pub mod cmath;
pub mod env;
pub mod fast_thread_local;
pub mod fs;
pub mod io;
pub mod memchr;
pub mod net;
pub mod os;
pub mod path;
pub mod pipe;
pub mod process;
pub mod stack_overflow;
pub mod stdio;
pub mod thread;
pub mod thread_local;
pub mod time;
pub use crate::sys_common::os_str_bytes as os_str;
cfg_if::cfg_if! {
if #[cfg(target_feature = "atomics")] {
#[path = "condvar_atomics.rs"]
pub mod condvar;
#[path = "mutex_atomics.rs"]
pub mod mutex;
#[path = "rwlock_atomics.rs"]
pub mod rwlock;
} else {
pub mod condvar;
pub mod mutex;
pub mod rwlock;
}
}
#[cfg(not(test))]
pub fn init() {}
pub fn unsupported<T>() -> crate::io::Result<T> {
Err(unsupported_err())
}
pub fn unsupported_err() -> crate::io::Error {
crate::io::Error::new(crate::io::ErrorKind::Other, "operation not supported on wasm yet")
}
pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind {
crate::io::ErrorKind::Other
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
pub enum Void {}
pub unsafe fn strlen(mut s: *const c_char) -> usize {
let mut n = 0;
while *s != 0 {
n += 1;
s = s.offset(1);
}
return n;
}
pub fn abort_internal() -> ! {
unsafe { crate::arch::wasm32::unreachable() }
}
pub fn hashmap_random_keys() -> (u64, u64) {
(1, 2)
}