Crate depper

source ·
Expand description

githubcrates-iodocs-rs


Library for detecting dependency cycles and finding missing dependencies. It also allows to sort dependencies into tranches, which can be used as a hierarchy dependency resolution.


Details

  • It exposes two structs DependencyBuilder and Dependencies. First is for building up the list of dependencies and building (calling the .build() function also validates the entire list) the second struct. Second is for generating tranches of dependencies for deployment hierarchies.

    use depper::Dependencies;
    
    let mut dependencies_builder = Dependencies::builder()
      .add_element("b".to_string(), vec!["d".to_string()])
      .add_element("c".to_string(), vec!["d".to_string()])
      .add_element("a".to_string(), vec!["d".to_string(), "e".to_string(), "y".to_string()])
      .add_element("d".to_string(), vec!["e".to_string()])
      .add_element("e".to_string(), vec![])
      .add_element("y".to_string(), vec![]);
       
    // Calling the `.build()` function validates the list of dependencies.
    let dependencies = dependencies_builder.build().unwrap();
      
    // The `.tranches()` function returns a list of tranches.
    println!("{:?}", dependencies.generate_tranches().unwrap());
    [["e", "y"], ["d"], ["b", "c", "a"]]
    

Structs