I/O Streams
Overview:
- Reliable in-order delivery of bytes
- or in the future, of arbitrary type
- Examples: sockets, pipes, character devices, files*
- Prototype: https://crates.io/crates/io-streams, https://crates.io/crates/nameless
Operations:
read
(input)write
(output)skip
(input) - likeread
but discards datawrite_zeros
(output) - likewrite
but just writes zerosflush
(output) - flush buffers, report errorsmedia_type
- return astring
with the IANA Media Type (eg. "image/jpeg")pseudonym
- return a handle to an identifierwrite_pseudonym
- (output) write the name of a pseudonym to the outputforward
-read
from an input andwrite
the data to another 💨
Constructors:
pipe
null
- (output) bit bucketfrom_array
- form a stream from an I/O array at a given offset