velt/native
API referenceWhat the Velt side of a package with native code binds its Rust functions with. Programs that don't wrap a native library never import it. For a walkthrough, read the guide.
Exports
IoError otherwise.checkIoThrows IoError if the operation failed.errorCodeNameThe Node-style name of a native function's failure code (code of a failed IoResult or IoStatus): "ENOENT", "ECONNREFUSED", "ETIMEDOUT", ...; what IoError.code holds.ioErrorBuilds the IoError for a failed result; takes ownership of the runtime's message.IoResultResult slot of a runtime operation producing a T (layout documented above).IoStatusResult slot of a runtime operation producing nothing (VeltErr).Re-exported from velt/native/result
function unwrapIo<T>(r: IoResult<T>): TThe value of a successful result; throws IoError otherwise.
Re-exported from velt/native/status
function checkIo(s: IoStatus)Throws IoError if the operation failed.
Re-exported from velt/native/error
function errorCodeName(code: i32): stringThe Node-style name of a native function's failure code (code of a failed IoResult or
IoStatus): "ENOENT", "ECONNREFUSED", "ETIMEDOUT", ...; what IoError.code holds.
Re-exported from velt/native/error
function ioError(code: i32, message: string): IoErrorBuilds the IoError for a failed result; takes ownership of the runtime's message.
Re-exported from velt/native/result
struct IoResult<T>Result slot of a runtime operation producing a T (layout documented above).
Parameter ofunwrapIo
| Field | Type | Description |
|---|---|---|
| code | i32 | — |
| message | string | — |
| value | T | — |
Re-exported from velt/native/status
Result slot of a runtime operation producing nothing (VeltErr).
Parameter ofcheckIo
| Field | Type | Description |
|---|---|---|
| code | i32 | — |
| message | string | — |