Patina Macro Crate
patina_macro hosts the procedural macros used in Patina. This includes those that support the Patina component
system, service registration, guided HOB parsing, on-target test discovery, and more. The
patina crate re-export these macros, so most cases only need a dependency on
patina.
Notable Macros
#[component]
- Applied to impl blocks containing an
entry_pointmethod to define components. - Validates parameters at compile time and generates the boilerplate required to satisfy
patina::component::IntoComponent. - The
entry_pointmethod must consumeselfand takes dependency-injected parameters implementingComponentParam. - Compile-time validation detects parameter conflicts such as duplicate
ConfigMut<T>or mixingConfig<T>andConfigMut<T>.
use ;
;
#[derive(IntoService)]
- Implements
patina::component::service::IntoServicefor a concrete provider. - Specify one or more service interfaces with
#[service(dyn TraitA, dyn TraitB)].
Note: The macro leaks the provider once and registers
'staticreferences so every component receives the same backing instance.
use IntoService;
;
#[derive(FromHob)]
- Bridges GUIDed Hand-Off Blocks (HOBs) into strongly typed Rust values.
- Attach the GUID with
#[hob = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"].
use FromHob;
#[patina_test]
- Registers a function with the Patina test runner that executes inside the DXE environment.
- Gate platform-specific tests with
cfg_attrso they only compile when the runner is active. - Optional attributes:
#[should_fail]or#[should_fail = "message"]#[skip]
use ;