Skip to main content

read_erf_from_bytes_with_options

Function read_erf_from_bytes_with_options 

Source
pub fn read_erf_from_bytes_with_options(
    bytes: &[u8],
    options: ErfReadOptions,
) -> Result<Erf, ErfBinaryError>
Expand description

Reads an ERF-family archive from bytes with explicit read options.

§Errors

ErfBinaryError::InvalidMagic and ErfBinaryError::InvalidVersion for a signature or version options.input does not accept. Which set that is differs by mode, so the same archive can read under CompatibilityAurora and be refused under CanonicalK1.

ErfBinaryError::InvalidHeader when the header is truncated or a table size it declares overflows, and ErfBinaryError::InvalidData when a declared region is not there: the localized-string block, either table, a key naming a resource id the resource table does not hold, or a resource whose data slice runs past the end.

ErfBinaryError::InvalidResRef for an entry name that is not a valid resref, and ErfBinaryError::TextDecoding for a localized string that is not valid text in the archive’s encoding.

Payload bytes are not validated. An entry whose contents are not the format its type claims reads without complaint.