async fn read(
        &mut self,
        offset: u64,
        length: u64,
        ) -> Result<Vec<u8>, Self::Error> {
        if (offset + length) as u64 > self.length {
            return Err(
                anyhow!(
                    "Read bounds exceeded. {} < {}..{}",
                    self.length,
                    offset,
                    offset + length
                    )
                .into(),
                );
        }

        let mut file = self.file.as_ref().expect("self.file was None.");
        let mut buffer = vec![0; length as usize];
        file.seek(SeekFrom::Start(offset)).await?;
        let _bytes_read = file.read(&mut buffer[..]).await?;
        Ok(buffer)
    }
// NOTE(yw): disabling clippy here because we files on disk might be sparse,
// and sometimes you might want to read a bit of memory to check if it's
// formatted or not. Returning zeroed out memory seems like an OK thing to do.
// We should probably come back to this at a future point, and determine
// whether it's okay to return a fully zeroed out slice. It's a bit weird,
// because we're replacing empty data with actual zeroes - which does not
// reflect the state of the world.
// #[cfg_attr(test, allow(unused_io_amount))]
disabling clippy here because we files on disk might be sparse,
and sometimes you might want to read a bit of memory to check if it's
formatted or not. Returning zeroed out memory seems like an OK thing to do.
We should probably come back to this at a future point, and determine
whether it's okay to return a fully zeroed out slice. It's a bit weird,
because we're replacing empty data with actual zeroes - which does not
reflect the state of the world.
disabling clippy here because we files on disk might be sparse and sometimes you might want to read a bit of memory to check if it ' s formatted or not . Returning zeroed out memory seems like an OK thing to do . We should probably come back to this at a future point and determine whether it ' s okay to return a fully zeroed out slice . It ' s a bit weird because we ' re replacing empty data with actual zeroes - which does not reflect the state of the world .
async fn read(
        &mut self,
        offset: u64,
        length: u64,
        ) -> Result<Vec<u8>, Self::Error> {
        if (offset + length) as u64 > self.length {
            return Err(
                anyhow!(
                    "Read bounds exceeded. {} < {}..{}",
                    self.length,
                    offset,
                    offset + length
                    )
                .into(),
                );
        }
        let mut file = self.file.as_ref().expect("self.file was None.");
        let mut buffer = vec![0; length as usize];
        file.seek(SeekFrom::Start(offset)).await?;
        let _bytes_read = file.read(&mut buffer[..]).await?;
        Ok(buffer)
    }
async fn read ( & mut self , offset : u64 , length : u64 , ) -> Result < Vec < u8 > , Self :: Error > { if ( offset + length ) as u64 > self . length { return Err ( anyhow ! ( " " self length offset offset length ) . into ( ) , ) ; } let mut file = self . file . as_ref ( ) . expect ( " " ) ; let mut buffer = vec ! [ 0 length as usize ] ; file . seek ( SeekFrom :: Start ( offset ) ) . await ? ; let _bytes_read = file . read ( & mut buffer [ .. ] ) . await ? ; Ok ( buffer ) }
NOTE(yw): disabling clippy here because we files on disk might be sparse,
and sometimes you might want to read a bit of memory to check if it's
formatted or not.
NOTE ( yw ) : disabling clippy here because we files on disk might be sparse and sometimes you might want to read a bit of memory to check if it ' s formatted or not .
&mut self
offset
u64
length
u64
&mut self
offset
u64
length
u64
[cfg_attr(test, allow(unused_io_amount))]
None