Skip to main content

Module readonly

Module readonly 

Source
Expand description

Read-only safety wrapper.

ReadOnlyDevice wraps any BlockRead and presents it as a BlockDevice whose write path is unconditionally crate::Error::ReadOnly and whose is_writable() is always false — regardless of what the underlying device supports.

Useful when the caller wants type-level certainty that no writes can land on a particular device, even if the underlying type could accept them. Examples: “snapshot view” of a writable image, an inspection tool that must never mutate, a slice handed across an FFI boundary that the consumer should not be able to write through.

Structs§

ReadOnlyDevice
Wraps any T: BlockRead and makes it read-only at the type level.