Skip to main content

build_class_name_index

Function build_class_name_index 

Source
fn build_class_name_index<'a>(
    entries: impl IntoIterator<Item = &'a ClassNameEntry>,
) -> HashMap<&'a str, &'a ClassNameEntry>
Expand description

Build the rust_type → ClassNameEntry lookup used by every placeholder resolver in write_r_wrappers_to_file.

Multiple labeled #[miniextendr] impl blocks on one type each register a ClassNameEntry (#1242) — the class name is a property of the type, so identical duplicates collapse here. Conflicting registrations (same rust_type, different r_class_name or class_system — e.g. two labeled blocks with disagreeing class = "..." overrides) panic: silently keeping whichever entry linkme ordered last would resolve .__MX_CLASS_REF_*__ placeholders nondeterministically.

Host-only like MX_CLASS_NAMES itself — the consumers all live in the wrapper-writing path, which never runs on wasm32.