first_declared_schema

Function first_declared_schema 

Source
pub fn first_declared_schema<T>(
    content: &[u8],
    recognise: impl FnMut(&str) -> Option<T>,
) -> Option<T>
Expand description

The first declared FILE_SCHEMA identifier that recognise accepts, read from the bounded header window (declared_schemas_bounded).

THE schema-selection rule: the first RECOGNISED identifier wins, so FILE_SCHEMA(('IFC2X3','IFC4X3')) is IFC2X3 and an unrecognised leading identifier is skipped rather than ending the search. It mirrors the TS parser’s detectSchemaVersion (packages/parser/src/source-header.ts). Every Rust reader of the declared schema goes through it with its own recogniser: the decoder’s attribute layout (SchemaVersion::from_file_schema) and processing’s reported schema_version (#7691).

What is shared is the SELECTION, not the recogniser. The decoder’s recogniser names only the schemas with an EXPRESS registry (no IFC5), processing’s also knows IFC5, so ('IFC5','IFC4') reads as IFC4 to the former and IFC5 to the latter, deliberately: guessing a nearby registry for IFC5 would relabel positional values (#7740).