sys
The sys module provides access to operating system level functionality:
files, sockets, processes, timers, and the netidx publish/subscribe
system. Each kind of stream (a file, a TCP or TLS connection, stdio, a
child process’s pipe) is its own type, and the Read, Lines, Write,
Close and Seek traits give them the same operations; see
sys::io.
| Module | Purpose |
|---|---|
sys::io | The stream traits, stdin/stdout/stderr |
sys::fs | Open files, directory operations, filesystem watching |
sys::tcp | TCP connect, listen, accept |
sys::tls | Upgrade TCP streams to TLS |
sys::process | Spawn child processes, their pipes and exit status |
sys::net | Netidx publish/subscribe and RPC |
sys::time | Timers and current time |
sys::dirs | Platform-aware standard directory paths |
mod io;
mod fs;
mod process;
mod tcp;
mod tls;
mod time;
mod net;
mod dirs;
/// the command line arguments. argv[0] names the program: the script
/// file, or a standalone binary's own path. A program an embedder runs
/// from source gets the arguments the embedder passes.
val args: fn() -> Array<string>;
/// join parts to path using the OS specific path separator
val join_path: fn(path: string, @args: [string, Array<string>]) -> string;
/// flush stdout/stderr and terminate the process with the given exit
/// code; a code outside 0..=255 exits with 1. The return type is fully polymorphic because the call never
/// actually returns; it fires when its argument produces a value, so
/// you can use it as the trailing expression of a program to make it
/// exit deterministically on completion.
val exit: fn(code: i64) -> 'a;