4 releases (breaking)

0.4.0 Sep 27, 2023
0.3.0 Aug 16, 2022
0.2.0 Aug 16, 2022
0.1.0 Aug 14, 2022

#1192 in Algorithms


Used in sdl-parser

MIT license

14KB
217 lines

Depper

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. API documentation can be found here.


lib.rs:

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"]]
    

Dependencies

~3MB
~46K SLoC