in internal-tools/fixture-manager/src/hakari_toml.rs [32:70]
fn iter(
fixture: &'g JsonFixture,
&count: &Self::IterArgs,
) -> Box<dyn Iterator<Item = Self::IterItem> + 'g> {
// Make a fresh generator for each output so that filtering by --fixtures continues to
// produce deterministic results.
let mut generator = ValueGenerator::from_seed(fixture.name());
let graph = fixture.graph();
// TODO: add tests for hakari id -- none of our fixtures appear to have a
// workspace-hack or other Hakari package
let hakari_builder_strategy = HakariBuilder::prop010_strategy(graph, Just(None));
let iter = (0..count).map(move |idx| {
// The partial clones mean that a change to the algorithm in part of the strategy won't
// affect the rest of it.
let mut iter_generator = generator.partial_clone();
let mut builder = iter_generator
.partial_clone()
.generate(&hakari_builder_strategy);
// The alternate fixture uses this registry.
if fixture.name() == "metadata_alternate_registries" {
builder.add_registries([("my-registry", METADATA_ALTERNATE_REGISTRY_URL)]);
}
let hakari = builder.compute();
let mut output_options = HakariOutputOptions::default();
output_options
.set_builder_summary(true)
.set_absolute_paths(true);
let toml = hakari
.to_toml_string(&output_options)
.expect("to_toml_string worked");
(idx, HakariTomlItem { hakari, toml })
});
Box::new(iter)
}