MCPcopy Index your code
hub / github.com/bytecodealliance/system-interface

github.com/bytecodealliance/system-interface @v0.27.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.27.3 ↗ · + Follow
128 symbols 225 edges 21 files 24 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

system-interface

<strong>Extensions to the Rust standard library</strong>

A Bytecode Alliance project

<a href="https://github.com/bytecodealliance/system-interface/actions?query=workflow%3ACI"><img src="https://github.com/bytecodealliance/system-interface/workflows/CI/badge.svg" alt="Github Actions CI Status" /></a>
<a href="https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime"><img src="https://img.shields.io/badge/zulip-join_chat-brightgreen.svg" alt="zulip chat" /></a>
<a href="https://crates.io/crates/system-interface"><img src="https://img.shields.io/crates/v/system-interface.svg" alt="crates.io page" /></a>
<a href="https://docs.rs/system-interface"><img src="https://docs.rs/system-interface/badge.svg" alt="docs.rs docs" /></a>

system-interface adds extensions to the Rust standard library, seeking to stay within the style of [std], while exposing additional functionality:

  • [fs::FileIoExt] - Extra support for working with files, including all the features of [std::io::Read], [std::io::Write], [std::io::Seek], and [std::os::unix::fs::FileExt], but with both POSIX-ish and Windows support, and with additional features, including read and write with all combinations of _vectored, _at, and _exact/_all. If you've ever wanted something like [read_exact_vectored_at], [write_all_vectored_at], or any other combination, or even [read_to_end_at] or [read_to_string_at], they're all here, and they work on Windows too!
  • [io::IsTerminal] - Test whether a given I/O handle refers to a terminal (aka a tty).
  • [io::ReadReady] - Query the number of bytes ready to be read immediately from an I/O handle.
  • [io::Peek] - Read from an I/O handle without consuming the data.

Everything in this crate is portable across popular POSIX-ish platforms and Windows.

Many of system-interface's features correspond to features in WASI, and are designed to work with [cap-std], however it's not specific to WASI and can be used with regular [std] too. To separate concerns, all sandboxing and capability-oriented APIs are left to cap-std, so this crate's features are usable independently.

Support for async-std and socket2 is temporarily disabled until those crates contain the needed implementations of the I/O safety traits.

Extension points exported contracts — how you extend this code

IoExt (Interface)
Extension trait for I/O handles that are exterior-mutable readable and writeable. [6 implementers]
src/io/io_ext.rs
FileIoExt (Interface)
Extension trait for `std::fs::File` and `cap_std::fs::File`. [4 implementers]
src/fs/file_io_ext.rs
Peek (Interface)
A trait providing the `peek` function for reading without consuming. Many common `Read` implementations have `Peek` imp [17 …
src/io/peek.rs
GetSetFdFlags (Interface)
Extension trait that can indicate various I/O flags. [2 implementers]
src/fs/fd_flags.rs
ReadReady (Interface)
Extension for readable streams that can indicate the number of bytes ready to be read immediately. [33 implementers]
src/io/read_ready.rs
IsReadWrite (Interface)
A trait for the `is_read_write` function. [12 implementers]
src/io/is_read_write.rs

Core symbols most depended-on inside this repo

use_feature_or_nothing
called by 13
build.rs
peek_from_bufread
called by 9
src/io/peek.rs
tmpdir
called by 8
tests/sys_common/io.rs
seek
called by 7
src/fs/file_io_ext.rs
file_is_read_write
called by 6
src/io/is_read_write.rs
raw_socket_is_read_write
called by 4
src/io/is_read_write.rs
reopen
called by 4
src/fs/file_io_ext.rs
write_at
called by 3
src/fs/file_io_ext.rs

Shape

Function 71
Method 49
Interface 6
Class 1
Enum 1

Languages

Rust100%

Modules by API surface

src/fs/file_io_ext.rs44 symbols
tests/vectored_at.rs27 symbols
src/io/io_ext.rs18 symbols
src/fs/fd_flags.rs6 symbols
tests/append.rs5 symbols
build.rs5 symbols
src/io/is_read_write.rs4 symbols
tests/read_to_end.rs3 symbols
tests/is_read_write.rs3 symbols
src/io/peek.rs3 symbols
tests/live_rename.rs2 symbols
tests/fd_flags.rs2 symbols

For agents

$ claude mcp add system-interface \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact