# std.Io: proof-of-concept "operations" API · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/6d22f7b4d7bd6d29ecbc5e3bd4a2e1c085f293a3)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 6d22f7b4d7bd6d29ecbc5e3bd4a2e1c085f293a3

Requested commit: 6d22f7b4d7bd6d29ecbc5e3bd4a2e1c085f293a3

Commit: 6d22f7b4d7bd6d29ecbc5e3bd4a2e1c085f293a3

Tree: 4c506ee95d083d90d793c2ed103f2d95307c24aa

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.Io: proof-of-concept "operations" API

This commit shows a proof-of-concept direction for std.Io.VTable to go,
which is to have general support for batching, timeouts, and
non-blocking.

I'm not sure if this is a good idea or not so I'm putting it up for
scrutiny.

This commit introduces `std.Io.operate`, `std.Io.Operation`, and
implements it experimentally for `FileReadStreaming`.

In `std.Io.Threaded`, the implementation is based on poll().

This commit shows how it can be used in `std.process.run` to collect
both stdout and stderr in a single-threaded program using
`std.Threaded.Io`.

It also demonstrates how to upgrade code that was previously using
`std.Io.poll` (*not* integrated with the interface!) using concurrency.
This may not be ideal since it makes the build runner no longer support
single-threaded mode. There is still a needed abstraction for
conveniently reading multiple File streams concurrently without
io.concurrent, but this commit demonstrates that such an API can be
built on top of the new `std.Io.operate` functionality.

```

## Parents

- [def22c2b63022b0c06dac8b5f7554deb644ca089](https://git.cafe/gitcafe/zig/commit/def22c2b63022b0c06dac8b5f7554deb644ca089?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/6d22f7b4d7bd6d29ecbc5e3bd4a2e1c085f293a3?format=markdown)
