Skip to main content

load_from_file

Function load_from_file 

Source
pub fn load_from_file(path: &Path) -> Result<PipelineConfig, ConfigError>
Expand description

Load a PipelineConfig from a TOML file.

Reads the file, parses it as TOML, and validates all semantic constraints.

§Arguments

  • path — Path to the TOML configuration file.

§Returns

  • Ok(PipelineConfig) if the file is readable, well-formed, and valid.
  • Err(ConfigError::Io) if the file cannot be read.
  • Err(ConfigError::Parse) if the TOML is malformed.
  • Err(ConfigError::Validation) if semantic constraints are violated.

§Panics

This function never panics.

§Example

ⓘ
use tokio_prompt_orchestrator::config::loader::load_from_file;
use std::path::Path;

let config = load_from_file(Path::new("pipeline.toml"))?;
println!("Loaded pipeline: {}", config.pipeline.name);