Skip to main content

BlockDevice

Trait BlockDevice 

Source
pub trait BlockDevice {
    // Required methods
    fn total_sectors(&self) -> usize;
    fn read_raw_sector(
        &mut self,
        sector: usize,
        buf: &mut [u8],
    ) -> Result<(), &'static str>;
    fn write_raw_sector(
        &mut self,
        sector: usize,
        buf: &[u8],
    ) -> Result<(), &'static str>;

    // Provided method
    fn should_mirror(&self) -> bool { ... }
}
Expand description

抽象ブロックデバイスの動作を規定するトレイト

Required Methods§

Source

fn total_sectors(&self) -> usize

デバイスの総セクタ数を取得します

Source

fn read_raw_sector( &mut self, sector: usize, buf: &mut [u8], ) -> Result<(), &'static str>

生セクタ (512バイト) の読み込みを行います (チェックサム検証なし)

Source

fn write_raw_sector( &mut self, sector: usize, buf: &[u8], ) -> Result<(), &'static str>

生セクタ (512バイト) の書き込みを行います (チェックサム検証なし)

Provided Methods§

Source

fn should_mirror(&self) -> bool

データの二重化(ミラーリング)が必要な外部記憶デバイスかどうか

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§