Expand description
Open registry of ArchCodec factories.
Arch crates register a factory function at process startup
(typically from <crate>::register()); resolution happens at
the entry of every compile / decompile pipeline call that needs
to encode arch-specific instructions.
The registry takes raw (arch_name, e_machine) pairs rather
than an AST type — that’s how this crate stays independent of
ud-ast (which would otherwise cause a cycle through
ud-arch-x86). Callers (ud-translate) extract the pair from
a parsed ud_ast::Module and feed it in.
Functions§
- factory_
count - Number of factories currently registered. Cheap; intended for tests and diagnostics.
- for_
arch - Resolve the codec for an
(arch_name, e_machine)pair. Returns the first matching factory’s result, orArchError::UnknownArchif nothing claims it. - register
- Register a codec factory. Each arch crate exposes a
register()pub fn that calls this once.
Type Aliases§
- Codec
Factory - A codec factory: inspects an
(arch_name, e_machine)pair and returns a codec instance if it recognises the arch, elseNone.arch_nameis the lowercase friendly arch identifier from the parsed@moduleblock ("x86_64","bpf", etc.);e_machineis the numeric ELF machine type (EM_BPF = 247,EM_SBF = 263, …) — useful for sub-arch dispatch (e.g. distinguishing Linux eBPF from Solana SBF when both carryarch = "bpf").