Skip to main content

read_gff_from_bytes

Function read_gff_from_bytes 

Source
pub fn read_gff_from_bytes(bytes: &[u8]) -> Result<Gff, GffBinaryError>
Expand description

Reads a binary GFF file from bytes.

§Errors

GffBinaryError::InvalidVersion for a version other than V3.2. There is no magic check: a GFF’s first four bytes are its file type, which varies per format, so a file that is not a GFF fails on its version or its layout rather than on a signature.

GffBinaryError::InvalidHeader when the header is truncated or a table offset overflows, and GffBinaryError::InvalidData for a tree that does not hang together: a struct or field index past its table, a field-indices run outside the index array, or a nesting depth past twice the struct count. That bound is the cycle guard, and it is deliberately loose, since a legitimate file can need more depth than it has structs.

GffBinaryError::InvalidFieldType for a type code this reader will not guess at, GffBinaryError::TextDecoding for a string that is not valid text in its declared encoding, and GffBinaryError::UnsupportedLanguageEncoding for a localized string whose language id maps to no codepage.