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
//! Typed Rust bindings to OpenComputers, for programs running on the
//! WebAssembly (wackasm) architecture.
//!
//! Build an ordinary WASI program (`--target wasm32-wasip1`) and use
//! components directly:
//!
//! ```no_run
//! use wackasm_opencomputers::prelude::*;
//!
//! let gpu = Gpu::first().expect("no GPU");
//! let (w, h) = gpu.get_resolution()?;
//! gpu.fill(1, 1, w, h, " ")?;
//! gpu.set(1, 1, "hello from Rust", None)?;
//!
//! // Wait for a key.
//! let key = signal::pull_filtered(None, |s| matches!(s, Signal::KeyDown { .. }));
//! # Ok::<(), wackasm_opencomputers::Error>(())
//! ```
//!
//! * [`components`]: a generated struct per component type (`Gpu`,
//! `Filesystem`, `Robot`, `Modem`, `Redstone`, ...), with a method for every
//! callback and OpenComputers' own docs.
//! * [`component`]: finding components, and untyped calls ([`Proxy`]).
//! * [`signal`]: typed events.
//! * [`computer`]: this computer's address, uptime, memory and power.
//! * [`process`]: running other programs, like `std::process`.
//! * [`draw`]: a framebuffer with text, half-block pixels, braille and
//! shapes, sent to the GPU with as few calls as possible.
//! * [`internet`]: HTTP requests and TCP connections through an internet card.
//! * `task` (with the `async` feature): an async executor, so programs can
//! wait on several component calls, timers and signals at once. Every
//! component method then has an `_async` twin.
//! * [`Side`], [`Color`], [`keys`]: the numeric codes components use.
//!
//! Files are simplest through `std::fs`, which the architecture maps onto a
//! disk. The `Filesystem` wrapper is there for other disks.
//!
//! Numbers cross as [`Number`]: an integer or a float, as OpenComputers sent
//! it, so integers stay exact.
pub use ;
pub use ;
pub use Signal;
pub use ;
pub use ;
/// Everything a typical program needs: `use wackasm_opencomputers::prelude::*;`