Replace common python-generated Rust code with equivalent hand-written code #31570
Labels
A-content/bindings
The DOM bindings
B-meta
This issue tracks the status of multiple, related pieces of work
I-refactor
No impact; the issue is one of maintainability or tidiness. Proposed solution requires refactoring.
We have a lot of Rust code that is generated at build time for each DOM interface. The code that generates it lives in https://github.com/servo/servo/blob/main/components/script/dom/bindings/codegen/CodegenRust.py. This file is very large and complicated to follow, so the tasks linked in this meta issue are designed to remove unnecessary complexity.
There are many methods in the generated Rust code that are virtually identical for many DOM interfaces. Rather than making the compiler parse and compile all that duplicated code, we should extract the code into generic functions that are called by the generated code instead.
#31569 is a model of how this extraction can be performed. It's recommended to find sample generated code under target/debug/build/script-[whatever]/out/Bindings/ so it's easier to understand the actual types of arguments in the functions being rewritten.
Tasks:
The text was updated successfully, but these errors were encountered: