Skip to main content

detect_format

Function detect_format 

Source
pub fn detect_format(path: &Path) -> Option<SemanticFormat>
Expand description

Detect the serialization format of a file by inspecting its extension and the first 16 bytes of content (magic bytes).

Extension check runs first (O(1)); magic-byte read is a fallback disambiguation step that opens the file for at most 16 bytes. Returns None only when neither heuristic yields a conclusive result.