vyre-build-scan 0.1.0

Build-time filesystem scanner for flat trait-impl registries
Documentation
//! Build-script fatal error helpers.

use std::env;
use std::path::PathBuf;

/// Abort the build with an actionable message.
pub(crate) fn fatal(message: impl std::fmt::Display) -> ! {
    eprintln!("{message}");
    std::process::exit(1);
}

/// Read a required Cargo-provided environment variable as a path.
pub(crate) fn required_env_path(name: &str) -> PathBuf {
    env::var(name).map(PathBuf::from).unwrap_or_else(|error| {
        fatal(format!(
            "build_scan: required environment variable {name} is unavailable: {error}. Fix: run through Cargo so build-script environment variables are set."
        ));
    })
}