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ยง
Enumsยง
- Slice
Error - Failure to read from a byte slice.
Traitsยง
- ReadAt
- Source that reads bytes at an offset.