pub struct Config {
pub options: ConfigRuntimeOptions,
pub files: Vec<FileOperation>,
pub commands: Vec<CommandOperation>,
}Expand description
Parsed and normalized treeboot config.
Fields§
§options: ConfigRuntimeOptionsRuntime options declared by the config.
files: Vec<FileOperation>Ordered file operations.
commands: Vec<CommandOperation>Ordered command operations.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load(path: &Path, context: &Worktree) -> Result<Self>
pub fn load(path: &Path, context: &Worktree) -> Result<Self>
Loads and parses a treeboot config from disk.
Relative paths inside the config are normalized against the supplied worktree context.
§Errors
Returns an error if the config cannot be read or TOML parsing and normalization fails.
Sourcepub fn parse(path: &Path, content: &str, context: &Worktree) -> Result<Self>
pub fn parse(path: &Path, content: &str, context: &Worktree) -> Result<Self>
Parses a treeboot config string.
The path is used for diagnostics. Relative paths inside the config are normalized against the supplied worktree context.
§Errors
Returns an error if TOML parsing or normalization fails.
Sourcepub fn discover_path(
context: &Worktree,
requested_config: Option<&Path>,
) -> Result<Option<PathBuf>>
pub fn discover_path( context: &Worktree, requested_config: Option<&Path>, ) -> Result<Option<PathBuf>>
Discovers the selected treeboot config path for a worktree.
When requested_config is provided, it is resolved relative to the
worktree path and must exist. When omitted, standard treeboot config
paths are searched in precedence order.
§Errors
Returns an error when a requested config path does not exist.
Sourcepub fn load_discovered(
context: &Worktree,
requested_config: Option<&Path>,
) -> Result<Option<LoadedConfig>>
pub fn load_discovered( context: &Worktree, requested_config: Option<&Path>, ) -> Result<Option<LoadedConfig>>
Discovers, loads, and parses the selected treeboot config.
Returns Ok(None) when no config was requested and no standard config
path exists.
§Errors
Returns an error if a requested config path does not exist, the selected config cannot be read, or TOML parsing and normalization fails.