Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunfishcode/io-arrays
Random-access I/O
https://github.com/sunfishcode/io-arrays
library rust
Last synced: 5 days ago
JSON representation
Random-access I/O
- Host: GitHub
- URL: https://github.com/sunfishcode/io-arrays
- Owner: sunfishcode
- License: other
- Created: 2021-01-14T01:37:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-11T06:12:50.000Z (10 months ago)
- Last Synced: 2024-10-26T11:50:10.670Z (18 days ago)
- Topics: library, rust
- Language: Rust
- Homepage:
- Size: 108 KB
- Stars: 11
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
Think of an *I/O array* as a `Vec` which lives outside the program. You can
index into it and copy data in and out. You can append to it or shrink it from
the back.In I/O terms, an I/O array is an abstraction of a "file". It supports doing I/O
at arbitrary offsets, appending, and truncating. You can read from it in a
streaming fashion using [`ReadAt::read_via_stream_at`].TODO: Writing to an array in a streaming fashion is not yet supported.
This crate defines [`ReadAt`], [`WriteAt`], and [`EditAt`] traits which define
interfaces to random-access or seekable devices, such as normal files, block
devices, disk partitions, and memory buffers.It also defines [`ArrayReader`], [`ArrayWriter`], and [`ArrayEditor`] types which
implement the above traits and and can be constructed from any file-like type.
On Posix-ish platforms, with support for WASI in development, these types just
contain a single file descriptor (and implement [`AsRawFd`]), plus any
resources needed to safely hold the file descriptor live. On Windows, they
contain a single file handle (and implement [`AsRawHandle`]).Support for async-std is temporarily disabled until those crates contain the
needed implementations of the I/O safety traits.[`ReadAt`]: https://docs.rs/io-arrays/latest/io_arrays/trait.ReadAt.html
[`WriteAt`]: https://docs.rs/io-arrays/latest/io_arrays/trait.WriteAt.html
[`EditAt`]: https://docs.rs/io-arrays/latest/io_arrays/trait.EditAt.html
[`ArrayReader`]: https://docs.rs/io-arrays/latest/io_arrays/struct.ArrayReader.html
[`ArrayWriter`]: https://docs.rs/io-arrays/latest/io_arrays/struct.ArrayWriter.html
[`ArrayEditor`]: https://docs.rs/io-arrays/latest/io_arrays/struct.ArrayEditor.html
[`AsRawFd`]: https://doc.rust-lang.org/std/os/unix/io/trait.AsRawFd.html
[`AsRawHandle`]: https://doc.rust-lang.org/std/os/windows/io/trait.AsRawHandle.html
[`ReadAt::read_via_stream_at`]: https://docs.rs/io-arrays/latest/io_arrays/trait.ReadAt.html#tymethod.read_via_stream_at