Skip to main content

Module device

Module device 

Source
Expand description

The Device trait: the only abstraction every other crate is allowed to use when it needs to write to “a thing.” The macOS raw-block-device impl lives in bootsmith-disk; in tests we substitute an in-memory Vec<u8> impl so cargo test works without root, without a USB stick, and without macOS.

Structs§

MemoryDevice
In-memory Device impl used by unit tests. Backed by a Vec<u8>.

Traits§

Device

Functions§

read_vec
Read len bytes at offset into a freshly-allocated Vec<u8>. Convenience wrapper around Device::read_at.
write_and_verify
Write buf at offset, then re-read and verify byte-equal. Returns Error::VerifyMismatch on the first divergence.