taskflow-rs 0.1.1

A high-performance, async-first task orchestration framework for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::error::{Result, TaskFlowError};
use std::fs;
use std::path::Path;

use super::TaskFlowConfig;

pub fn load_from_yaml_file<P: AsRef<Path>>(path: P) -> Result<TaskFlowConfig> {
    let content = fs::read_to_string(path)
        .map_err(|e| TaskFlowError::ConfigError(format!("Failed to read config file: {}", e)))?;

    serde_yaml::from_str(&content)
        .map_err(|e| TaskFlowError::ConfigError(format!("Failed to parse YAML config: {}", e)))
}

pub fn load_from_yaml_str(content: &str) -> Result<TaskFlowConfig> {
    serde_yaml::from_str(content)
        .map_err(|e| TaskFlowError::ConfigError(format!("Failed to parse YAML config: {}", e)))
}