Skip to main content

Module io

Module io 

Source
Expand description

The three standard streams’ intrinsics for std/io. pub, not private, for the same reason as fs and bytes: its own doc comment explains the boundary it implements. Branch read-write-stdio’s Task 1 added this module beside fs and bytes, reusing fs‘s per-task slot table rather than owning a second one. The three standard streams’ boundary.

Each intrinsic acquires the process-global stream, acts, and drops it inside the one call – the same shape nova_rt_print/nova_rt_eprint have used since phase 1. Nothing here holds an OS handle between calls, which is why these three types need no lifetime management and File (increment 3c) will.

Payloads travel in the per-task slot table fs owns. No panic may cross a generated poll boundary, so nothing here unwraps, expects, indexes a slice, or formats fallibly.

§Two boundary decisions, recorded here as well as in the task report that

§made them

How a write’s byte count reaches Nova. The status word already carries the IoErrorKind on failure, so it cannot also carry a count on success without a sentinel this boundary does not have. It travels instead as a Bytes payload in the existing [Slot::Buffer], not a new Slot variant – see [stash_count]’s own doc comment for why, and for the encoding a Nova wrapper must decode.

write, not write_all. nova_rt_io_stdout_write and nova_rt_io_stderr_write each make one Write::write call and report whatever count it returns, rather than looping until the whole buffer is sent. See nova_rt_io_stdout_write’s own doc comment for why.

Functions§

nova_rt_io_stderr_flush⚠
Flush stderr. Mirrors nova_rt_io_stdout_flush exactly, against the other stream.
nova_rt_io_stderr_write⚠
Write buf’s bytes to stderr. Mirrors nova_rt_io_stdout_write exactly, against the other stream.
nova_rt_io_stdin_read⚠
Read up to max bytes from stdin. An empty payload means end of stream.
nova_rt_io_stdout_flush⚠
Flush stdout.
nova_rt_io_stdout_write⚠
Write buf’s bytes to stdout. See [write_and_stash] for why this is one write call rather than a write_all loop, and [stash_count] for how the reported count crosses back into Nova.