pub struct CommandRegistry { /* private fields */ }Expand description
Registry of known CMake command specifications used to guide formatting.
The registry describes the argument structure of each command — positional slots, keyword sections, flags, and per-form layout hints — so the formatter can group and wrap arguments correctly.
§Two-tier model
The built-in registry covers the full CMake standard library. User override files (TOML or YAML) can extend or modify any entry without replacing the whole registry.
§Getting a registry
| Situation | Recommended call |
|---|---|
| No customisation needed | CommandRegistry::builtins — lazily initialised singleton, cheapest |
| Fresh owned copy | CommandRegistry::load — allocates every call |
| Merge with user override file | CommandRegistry::from_builtins_and_overrides |
Implementations§
Source§impl CommandRegistry
impl CommandRegistry
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load the embedded built-in registry from builtins.toml.
Returns a fresh owned CommandRegistry on every call. Prefer
CommandRegistry::builtins when you only need a read-only reference —
it initialises once and amortises the parse cost across all callers.
Sourcepub fn builtins() -> &'static Self
pub fn builtins() -> &'static Self
Return the lazily initialised built-in registry singleton.
The registry is parsed exactly once on first call; subsequent calls
return a &'static reference at zero cost. Use CommandRegistry::load
if you need an owned, mutable copy.
Sourcepub fn from_builtins_and_overrides(
path: Option<impl AsRef<Path>>,
) -> Result<Self>
pub fn from_builtins_and_overrides( path: Option<impl AsRef<Path>>, ) -> Result<Self>
Load the embedded built-ins and optionally merge a user override file.
Sourcepub fn merge_toml_overrides(&mut self, toml_source: &str) -> Result<()>
pub fn merge_toml_overrides(&mut self, toml_source: &str) -> Result<()>
Merge TOML-formatted command spec overrides from a string.
Sourcepub fn merge_yaml_overrides(&mut self, yaml_source: &str) -> Result<()>
pub fn merge_yaml_overrides(&mut self, yaml_source: &str) -> Result<()>
Merge YAML-formatted command spec overrides from a string.
Sourcepub fn merge_override_file(&mut self, path: &Path) -> Result<()>
pub fn merge_override_file(&mut self, path: &Path) -> Result<()>
Merge a supported user override file from disk into the registry.
Sourcepub fn merge_override_str(
&mut self,
source: &str,
path: impl Into<PathBuf>,
) -> Result<()>
pub fn merge_override_str( &mut self, source: &str, path: impl Into<PathBuf>, ) -> Result<()>
Merge TOML override contents into the registry.
Sourcepub fn get(&self, command_name: &str) -> &CommandSpec
pub fn get(&self, command_name: &str) -> &CommandSpec
Get the command spec for command_name, falling back to a permissive
default when the command is unknown.
Sourcepub fn contains_builtin(&self, command_name: &str) -> bool
pub fn contains_builtin(&self, command_name: &str) -> bool
Return true when the command is present in the built-in registry.
Sourcepub fn audited_cmake_version(&self) -> &str
pub fn audited_cmake_version(&self) -> &str
Report the audited upstream CMake version for the built-in spec.
Trait Implementations§
Source§impl Clone for CommandRegistry
impl Clone for CommandRegistry
Source§fn clone(&self) -> CommandRegistry
fn clone(&self) -> CommandRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more