-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlib.rs
52 lines (42 loc) · 860 Bytes
/
lib.rs
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
#![feature(
const_fn,
link_llvm_intrinsics,
allocator_api,
naked_functions,
)]
extern crate nabi;
#[macro_use]
mod print;
pub mod abi;
mod types;
mod handle;
mod wasm;
mod process;
mod channel;
mod event;
// mod mutex;
// mod dlmalloc;
pub mod interrupt;
pub mod driver;
pub use handle::Handle;
pub use wasm::Wasm;
pub use process::Process;
pub use channel::{Channel, WriteChannel, ReadChannel};
pub use event::Event;
// pub use mutex::{Mutex, MutexGuard};
use std::fmt;
pub use nabi::{Result, Error};
// #[global_allocator]
// static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
pub fn print(x: &str) {
unsafe {
abi::print(x.as_ptr(), x.len());
}
}
pub struct PrintWriter;
impl fmt::Write for PrintWriter {
fn write_str(&mut self, s: &str) -> fmt::Result {
print(s);
Ok(())
}
}