11 releases (breaking)

0.10.0 Jun 23, 2022
0.9.0 Feb 1, 2022
0.8.0 Jan 21, 2022
0.7.0 Dec 24, 2021
0.3.0 Mar 5, 2021

#537 in Rust patterns

Download history 3/week @ 2022-03-09 42/week @ 2022-03-16 22/week @ 2022-03-23 7/week @ 2022-03-30 8/week @ 2022-04-06 4/week @ 2022-04-13 2/week @ 2022-04-20 83/week @ 2022-04-27 53/week @ 2022-05-04 159/week @ 2022-05-11 47/week @ 2022-05-18 54/week @ 2022-05-25 82/week @ 2022-06-01 22/week @ 2022-06-08 3/week @ 2022-06-15 39/week @ 2022-06-22

146 downloads per month
Used in nameless

Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT

85KB
2K SLoC

io-arrays

Random-access I/O

Github Actions CI Status crates.io page docs.rs docs

Think of an I/O array as a Vec<u8> 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).

Dependencies

~1.6–8MB
~150K SLoC