# block_dev.rs - source
Source of the Rust file `/home/runner/work/rCore-Tutorial-v3/rCore-Tutorial-v3/easy-fs/src/block_dev.rs`.
Keywords: rust, rustlang, rust-lang

    1
    2
    3
    4
    5
    6
    7
    8
    9

    use core::any::Any;
    /// Trait for block devices
    /// which reads and writes data in the unit of blocks
    pub trait BlockDevice: Send + Sync + Any {
        ///Read data form block to buffer
        fn read_block(&self, block_id: usize, buf: &mut [u8]);
        ///Write data from buffer to block
        fn write_block(&self, block_id: usize, buf: &[u8]);
    }