Skip to main content

Crate nanvm_effects_node

Crate nanvm_effects_node 

Source
Expand description

The native runner of effects: the Rust twin of the loop in fjs/effects/module.mjs, over nanvm-lib’s own values.

An effect is what fjs/effects builds, and the program’s own VM values stay as they are: a Pure, a function that takes nothing and answers a Result, or a Do, an object with the command to perform, its payload and the continuation that takes the answer to the next effect. There is no native copy of any of it: the loop reads three properties, calls two kinds of function and hands values on, so identity survives. Only a Native host, the perform over std, reads a request out of VM values, and writes its answer back.

nanvm-effects-node depends on nanvm-lib, never the reverse.

Structs§

Dirent
An entry of a directory, as Node’s Dirent.
FileModule
The module a specifier names: the real path of its file and its identity, a file: URL.
IoError
A failed operation as the error channel carries it: the Node error code where there is one, and a message.
Native
A host over std, reading console input from R and writing console output to O and E.

Constants§

MAX_FILE_SIZE_BYTES
The most a file may hold to be read: one Vec, which the language caps at 2^17 bytes (maxLengthBytes in fjs/types/bit_vec). Metadata can refuse a larger file before reading; the read also checks the bytes actually returned.

Functions§

normalize
normalize of fjs/path, for the paths a directory read answers: \ is /, empty and . segments vanish, .. cancels the segment before it or is kept where nothing is left to cancel, and a root, /, // or a drive’s C:/, stays and absorbs the .. that would climb past it. A bare C: and the drive-relative C:a are ordinary segments, as they are there.
resolve_file_module
The module name names, from the file parent’s identity, or from the working directory where there is none: the real path and its identity.
run
Performs effect to its result.