pub fn read(&mut self, filesystem: &FileSystem, length: usize) -> Result<Vec<il::Expression>> {
        let bytes = filesystem
            .file_bytes(&self.path)
            .ok_or("Failed to get bytes for filedescriptor")?;

        if bytes.len() <= self.offset {
            Ok(Vec::new())
        } else {
            let top = if self.offset + length > bytes.len() {
                self.offset + bytes.len()
            } else {
                self.offset + length
            };

            let data = bytes
                .get(self.offset..top)
                .ok_or("Failed to get bytes for filedescriptor")?;

            self.offset = top;

            Ok(data.to_vec())
        }
    }
/// Read the given number of bytes from this `FileDescriptor`.
///
/// Updates the internal offset.
Read the given number of bytes from this `FileDescriptor`.
Updates the internal offset.
Read the given number of bytes from this ` FileDescriptor ` . Updates the internal offset .
pub fn read(&mut self, filesystem: &FileSystem, length: usize) -> Result<Vec<il::Expression>> {
        let bytes = filesystem
            .file_bytes(&self.path)
            .ok_or("Failed to get bytes for filedescriptor")?;
        if bytes.len() <= self.offset {
            Ok(Vec::new())
        } else {
            let top = if self.offset + length > bytes.len() {
                self.offset + bytes.len()
            } else {
                self.offset + length
            };
            let data = bytes
                .get(self.offset..top)
                .ok_or("Failed to get bytes for filedescriptor")?;
            self.offset = top;
            Ok(data.to_vec())
        }
    }
pub fn read ( & mut self , filesystem : & FileSystem , length : usize ) -> Result < Vec < il :: Expression > > { let bytes = filesystem . file_bytes ( & self . path ) . ok_or ( " " ) ? ; if bytes . len ( ) <= self . offset { Ok ( Vec :: new ( ) ) } else { let top = if self . offset + length > bytes . len ( ) { self . offset + bytes . len ( ) } else { self . offset + length } ; let data = bytes . get ( self . offset .. top ) . ok_or ( " " ) ? ; self . offset = top ; Ok ( data . to_vec ( ) ) } }
Read the given number of bytes from this `FileDescriptor`.
Read the given number of bytes from this ` FileDescriptor ` .
&mut self
filesystem
&FileSystem
length
usize