pub struct Config {
pub output: OutputConfig,
pub docs: DocsConfig,
pub theme: BTreeMap<String, ThemeColor>,
pub externals: Vec<External>,
pub sections: BTreeMap<String, Value>,
pub path: Option<PathBuf>,
}Expand description
The parsed asbuilt.toml.
Other top-level entries stay in sections, where a front-end’s table
([rust], say) waits to be deserialized with that front-end’s schema;
Config::check_tables rejects any that names no front-end. Unknown
keys inside [output] or an [[externals]] entry are rejected
when parsing.
use asbuilt_core::Config;
let config: Config = r#"
[output]
path = "arch/model.c4"
[rust]
include_tests = false
"#
.parse()
.unwrap();
assert_eq!(config.output.path, "arch/model.c4");
assert!(config.sections.contains_key("rust"));Fields§
§output: OutputConfig§docs: DocsConfig§theme: BTreeMap<String, ThemeColor>[theme]: a color per element kind (container, component,
bin, tests, examples, or an external kind), emitted as
LikeC4 element styles so the
diagrams come out in the consumer’s palette.
externals: Vec<External>§sections: BTreeMap<String, Value>§path: Option<PathBuf>Where this config was read from, for error messages. None for a
config parsed from a string or defaulted.
Implementations§
Source§impl Config
impl Config
Sourcepub fn light_theme(&self) -> BTreeMap<String, String>
pub fn light_theme(&self) -> BTreeMap<String, String>
The light color per themed kind, the emitter’s input.
Source§impl Config
impl Config
Sourcepub fn load(root: &Path) -> Result<Self>
pub fn load(root: &Path) -> Result<Self>
The config at root/asbuilt.toml, or the defaults when there is
no such file.
Sourcepub fn load_file(path: &Path) -> Result<Self>
pub fn load_file(path: &Path) -> Result<Self>
A config from an explicit path (--config); a missing file is an
error here, unlike Config::load.
Sourcepub fn file_path(&self) -> PathBuf
pub fn file_path(&self) -> PathBuf
The file this config came from, for error messages: asbuilt.toml
when it was parsed from a string or defaulted.
Sourcepub fn check_tables(&self, frontends: &[&str]) -> Result<()>
pub fn check_tables(&self, frontends: &[&str]) -> Result<()>
Every top-level entry is asbuilt’s own or the table of one of
frontends (by Frontend::name); the
first that is neither is an error naming it as written.