distrib-rust 0.0.4

Distrib helps you distribute your software.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// This is free and unencumbered software released into the public domain.

use super::{LoadManifestError, Manifest, Value};
use std::path::{Path, absolute};

pub fn load_cargo_toml(path: impl AsRef<Path>) -> Result<Manifest, LoadManifestError> {
    let path = path.as_ref();
    let input = std::fs::read_to_string(path)?;
    let mut manifest = Manifest::from_str(&input)?;
    if manifest.needs_workspace_inheritance() {
        let path = absolute(path)?; // needs an absolute path here
        manifest.complete_from_path(&path)?;
    }
    Ok(manifest)
}