codama-stores 0.9.2

Load the content of crates recursively in stores
Documentation
use crate::CrateStore;
use codama_errors::{CodamaResult, IteratorCombineErrors};
use std::path::Path;

#[derive(Debug, PartialEq)]
pub struct RootStore {
    pub crates: Vec<CrateStore>,
}

impl RootStore {
    pub fn load<P: AsRef<Path>>(path: P) -> CodamaResult<Self> {
        Self::load_all(&[path])
    }

    pub fn load_all<P: AsRef<Path>>(paths: &[P]) -> CodamaResult<Self> {
        Ok(Self {
            crates: paths
                .iter()
                .map(CrateStore::load)
                .collect_and_combine_errors()?,
        })
    }

    pub fn hydrate(tt: proc_macro2::TokenStream) -> CodamaResult<Self> {
        Ok(Self {
            crates: vec![CrateStore::hydrate(tt)?],
        })
    }
}