fn record_data(
        record_data_offset: u32,
        next_record_data_offset: u32,
        extra_bytes: u32,
        compression_type: &Compression,
        content: &[u8],
    ) -> io::Result<Vec<u8>> {
        match compression_type {
            Compression::No => Ok(content[record_data_offset as usize..next_record_data_offset as usize].to_vec()),
            Compression::PalmDoc => {
                if record_data_offset < content.len() as u32
                    && record_data_offset < next_record_data_offset - extra_bytes
                {
                    Ok(lz77::decompress_lz77(
                        &content[record_data_offset as usize..(next_record_data_offset - extra_bytes) as usize],
                    ))
                } else {
                    Err(io::Error::new(
                        ErrorKind::NotFound,
                        "record points to location out of bounds",
                    ))
                }
            }
            Compression::Huff => panic!("Huff compression is currently not supported"),
        }
    }
/// Reads the content of a record at specified offset
Reads the content of a record at specified offset
Reads the content of a record at specified offset
fn record_data(
        record_data_offset: u32,
        next_record_data_offset: u32,
        extra_bytes: u32,
        compression_type: &Compression,
        content: &[u8],
    ) -> io::Result<Vec<u8>> {
        match compression_type {
            Compression::No => Ok(content[record_data_offset as usize..next_record_data_offset as usize].to_vec()),
            Compression::PalmDoc => {
                if record_data_offset < content.len() as u32
                    && record_data_offset < next_record_data_offset - extra_bytes
                {
                    Ok(lz77::decompress_lz77(
                        &content[record_data_offset as usize..(next_record_data_offset - extra_bytes) as usize],
                    ))
                } else {
                    Err(io::Error::new(
                        ErrorKind::NotFound,
                        "record points to location out of bounds",
                    ))
                }
            }
            Compression::Huff => panic!("Huff compression is currently not supported"),
        }
    }
fn record_data ( record_data_offset : u32 , next_record_data_offset : u32 , extra_bytes : u32 , compression_type : & Compression , content : & [ u8 ] , ) -> io :: Result < Vec < u8 > > { match compression_type { Compression :: No => Ok ( content [ record_data_offset as usize .. next_record_data_offset as usize ] . to_vec ( ) ) , Compression :: PalmDoc => { if record_data_offset < content . len ( ) as u32 && record_data_offset < next_record_data_offset - extra_bytes { Ok ( lz77 :: decompress_lz77 ( & content [ record_data_offset as usize .. ( next_record_data_offset - extra_bytes ) as usize ] , ) ) } else { Err ( io :: Error :: new ( ErrorKind :: NotFound , " " , ) ) } } Compression :: Huff => panic ! ( " " ) , } }
Reads the content of a record at specified offset
Reads the content of a record at specified offset
record_data_offset
u32
next_record_data_offset
u32
extra_bytes
u32
compression_type
&Compression
content
&[u8]
record_data_offset
u32
next_record_data_offset
u32
extra_bytes
u32
compression_type
&Compression
content
&[u8]