Lines Matching refs:stream

11   /// `wasi:io/streams/stream-error` type.
81 /// stream types.
83 /// In the future, the component model is expected to add built-in stream types;
92 /// An error for input-stream and output-stream operations.
94 variant stream-error {
99 /// After this, the stream will be closed. All future operations return
100 /// `stream-error::closed`.
102 /// The stream is closed: no more input will be accepted by the
103 /// stream. A closed output-stream will return this error on all
110 /// `input-stream`s are *non-blocking* to the extent practical on underlying
117 resource input-stream {
118 /// Perform a non-blocking read from the stream.
132 /// This function fails with a `stream-error` when the operation
134 /// stream is closed, giving `closed`.
137 /// read 0 bytes. If the stream is still open, this call should
145 read: func(len: u64) -> result<list<u8>, stream-error>;
146 /// Read bytes from a stream, after blocking until at least one byte can
149 blocking-read: func(len: u64) -> result<list<u8>, stream-error>;
150 /// Skip bytes from a stream. Returns number of bytes skipped.
153 /// of bytes, returns the number of bytes consumed from the stream.
155 skip: func(len: u64) -> result<u64, stream-error>;
156 /// Skip bytes from a stream, after blocking until at least one byte
159 blocking-skip: func(len: u64) -> result<u64, stream-error>;
160 /// Create a `pollable` which will resolve once either the specified stream
161 /// has bytes available to read or the other end of the stream has been
163 /// The created `pollable` is a child resource of the `input-stream`.
164 /// Implementations may trap if the `input-stream` is dropped before
172 /// `output-stream`s are *non-blocking* to the extent practical on
175 /// promptly, which could even be zero. To wait for the stream to be ready to
179 /// Dropping an `output-stream` while there's still an active write in
180 /// progress may result in the data being lost. Before dropping the stream,
183 resource output-stream {
194 check-write: func() -> result<u64, stream-error>;
206 /// returns Err(closed) without writing if the stream has closed since
209 write: func(contents: list<u8>) -> result<_, stream-error>;
210 /// Perform a write of up to 4096 bytes, and then flush the stream. Block
220 /// // Wait for the stream to become writable
235 blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>;
238 /// This tells the output-stream that the caller intends any buffered
242 /// Upon calling this function, the `output-stream` will not accept any
245 /// flush has completed and the stream can accept more writes.
247 flush: func() -> result<_, stream-error>;
249 /// and stream is ready for writing again.
251 blocking-flush: func() -> result<_, stream-error>;
252 /// Create a `pollable` which will resolve once the output-stream
257 /// If the stream is closed, this pollable is always ready immediately.
259 /// The created `pollable` is a child resource of the `output-stream`.
260 /// Implementations may trap if the `output-stream` is dropped before
264 /// Write zeroes to a stream.
271 write-zeroes: func(len: u64) -> result<_, stream-error>;
272 /// Perform a write of up to 4096 zeroes, and then flush the stream.
283 /// // Wait for the stream to become writable
297 blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>;
298 /// Read from one stream and write to another.
301 /// 1. calling `check-write` on the `output-stream`
302 /// 2. calling `read` on the `input-stream` with the smaller of the
304 /// 3. calling `write` on the `output-stream` with that read data.
312 splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>;
313 /// Read from one stream and write to another, with blocking.
316 /// `output-stream` is ready for writing, and the `input-stream`
319 blocking-splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>;