Skip to main content

Crate flashkit_io

Crate flashkit_io 

Expand description

Positional reads from flash images.

ReadAt reads bytes at an offset. It has no cursor, so several readers can share one source and read from any position without seeking. Byte slices implement it. With the std feature, files on unix and Windows do too. On other targets the feature does nothing.

Files have a cursor for std::io::Read and std::io::Seek, which ReadAt ignores. On Windows, reads move that cursor. For device files, ReadAt::size seeks to the end and back, because their metadata has no size.

use flashkit_io::ReadAt as _;

let image = [0x55, 0x42, 0x49, 0x23, 0x01];
let mut magic = [0; 4];
image.as_slice().read_exact_at(0, &mut magic)?;
assert_eq!(&magic, b"UBI#");

Modulesยง

file ๐Ÿ”’ std and (Unix or Windows)
read_at ๐Ÿ”’
slice ๐Ÿ”’

Enumsยง

SliceError
Failure to read from a byte slice.

Traitsยง

ReadAt
Source that reads bytes at an offset.