Skip to main content

Module factory

Module factory 

Source
Expand description

The factory (design-doc §15, D69–D75).

rustdv has a factory, and it works as the UVM factory works (D74). It is not a separate subsystem: a “maker” is an ordinary Rust value, so the override table is the ConfigDb and registration is a link-time section like the test registry. From the user’s chair there are two constructors — Foo::new_comp() (fixed) and Foo::create_comp() (overridable) — and Factory::… to install and inspect overrides.

How a create_comp() slot is overridden. It is not resolved at the call — a create_comp() builds the default type immediately and flags the RustdvComp as factory-owned (D75). During the build walk, where the field name and so the path are finally known, the framework asks each flagged slot for its override (instance first, then type, by ConfigDb specificity, D13) and swaps it in before descending.

Structs§

ComponentReg
One registered component: its name and its maker. Emitted by #[derive(Component)] for every component, universally (D73).
Factory
The factory. Ambient, like the ConfigDb it is built on; every method is an associated function.
Override
An installed override: what to build, and the target’s name for the dump.
RustdvComp
A slot that holds any component. It says nothing about position in the tree and nothing about overridability; the build line decides that (new_comp() fixed, create_comp() overridable). Every child field a block may want to override is an RustdvComp.

Type Aliases§

Maker
A maker: builds a component with no arguments (its name and parent come from the tree, D7). Non-capturing, so it is an ordinary fn pointer.