# BlockDevice in easy_fs - Rust
Trait for block devices which reads and writes data in the unit of blocks
Keywords: rust, rustlang, rust-lang, BlockDevice

# Trait easy_fs::BlockDevice

source · [−]

    pub trait BlockDevice: Send + Sync + Any {
        fn read_block(&self, block_id: usize, buf: &mut [u8]);
        fn write_block(&self, block_id: usize, buf: &[u8]);
    }

Expand description

Trait for block devices which reads and writes data in the unit of blocks

## Required methods

source

#### fn read_block(&self, block_id: usize, buf: &mut [ u8 ])

Read data form block to buffer

source

#### fn write_block(&self, block_id: usize, buf: &[ u8 ])

Write data from buffer to block

## Implementors