Function register_format_detection_hook
pub fn register_format_detection_hook(extension: OsString, signature: &'static [u8], mask: Option<&'static [u8]>)
Registers a format detection hook.
The signature field holds the magic bytes from the start of the file that must be matched to detect the format. The mask field is optional and can be used to specify which bytes in the signature should be ignored during the detection.
Examples
Using the mask to ignore some bytes
# use register_format_detection_hook;
// WebP signature is 'riff' followed by 4 bytes of length and then by 'webp'.
// This requires a mask to ignore the length.
register_format_detection_hook;
Multiple signatures
# use register_format_detection_hook;
// JPEG XL has two different signatures: https://en.wikipedia.org/wiki/JPEG_XL
// This function should be called twice to register them both.
register_format_detection_hook;
register_format_detection_hook;