pub trait BlockDevice: BlockRead {
// Provided methods
fn write_at(&self, _offset: u64, _buf: &[u8]) -> Result<()> { ... }
fn flush(&self) -> Result<()> { ... }
fn is_writable(&self) -> bool { ... }
}Expand description
Read-write random-access block device. Implementors that genuinely
support writes override write_at / flush / is_writable. The
defaults model a strict read-only device.
Provided Methods§
Sourcefn write_at(&self, _offset: u64, _buf: &[u8]) -> Result<()>
fn write_at(&self, _offset: u64, _buf: &[u8]) -> Result<()>
Write exactly buf.len() bytes at offset. Default: returns
Error::ReadOnly.
Sourcefn is_writable(&self) -> bool
fn is_writable(&self) -> bool
Whether write_at is likely to succeed. Mount paths use this to
decide whether to attempt journal replay or stay strict-read-only.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: BlockDevice + ?Sized> BlockDevice for Arc<T>
impl<T: BlockDevice + ?Sized> BlockDevice for Arc<T>
Source§impl<T: BlockDevice + ?Sized> BlockDevice for Box<T>
impl<T: BlockDevice + ?Sized> BlockDevice for Box<T>
Implementors§
impl BlockDevice for CachingDevice
impl BlockDevice for CallbackDevice
impl BlockDevice for FileDevice
impl BlockDevice for OwnedRwSlice
impl BlockDevice for OwnedSlice
Same rationale as SliceReader: read-only by default.
impl<'a> BlockDevice for SliceReader<'a>
Slices are read-only by default — even where the parent is writable, slicing is almost always paired with a read-only inspection or dispatch workflow.
impl<T: BlockRead> BlockDevice for ReadOnlyDevice<T>
BlockDevice impl uses the trait’s default (Err(ReadOnly) for
write_at, no-op flush, is_writable() -> false). Even if T
implements BlockDevice with full writes, the wrapper hides that.