floe-core 0.3.6

Core library for Floe, a YAML-driven technical ingestion tool.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::{config, ConfigError, FloeResult};

pub fn require_field(
    definition: &config::StorageDefinition,
    value: Option<&String>,
    field: &str,
    kind: &str,
) -> FloeResult<String> {
    value
        .cloned()
        .ok_or_else(|| -> Box<dyn std::error::Error + Send + Sync> {
            Box::new(ConfigError(format!(
                "storage {} requires {} for type {}",
                definition.name, field, kind
            )))
        })
}