Skip to content

Commit

Permalink
Update the wit-smith crates
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed May 13, 2023
1 parent ecd6ca7 commit fd8a147
Show file tree
Hide file tree
Showing 5 changed files with 341 additions and 174 deletions.
2 changes: 2 additions & 0 deletions crates/wit-smith/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ arbitrary = { workspace = true, features = ["derive"] }
wit-component = { workspace = true }
wit-parser = { workspace = true }
clap = { workspace = true, optional = true }
indexmap = { workspace = true }
log = { workspace = true }
16 changes: 8 additions & 8 deletions crates/wit-smith/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ pub struct Config {
pub max_interface_items: usize,
#[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().max_world_items))]
pub max_world_items: usize,
#[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().max_doc_items))]
pub max_doc_items: usize,
#[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().max_documents))]
pub max_documents: usize,
#[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().max_pkg_items))]
pub max_pkg_items: usize,
#[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().max_type_parts))]
pub max_type_parts: usize,
#[cfg_attr(feature = "clap", clap(long, default_value_t = Config::default().max_files_per_package))]
pub max_files_per_package: usize,
}

impl Default for Config {
Expand All @@ -26,9 +26,9 @@ impl Default for Config {
max_type_size: 100,
max_interface_items: 10,
max_world_items: 10,
max_doc_items: 10,
max_documents: 10,
max_pkg_items: 10,
max_type_parts: 10,
max_files_per_package: 10,
}
}
}
Expand All @@ -37,11 +37,11 @@ impl Arbitrary<'_> for Config {
fn arbitrary(u: &mut Unstructured<'_>) -> Result<Config> {
Ok(Config {
max_packages: u.int_in_range(1..=20)?,
max_documents: u.int_in_range(1..=10)?,
max_files_per_package: u.int_in_range(1..=10)?,
max_type_size: u.int_in_range(0..=1000)?,
max_interface_items: u.int_in_range(0..=20)?,
max_world_items: u.int_in_range(0..=10)?,
max_doc_items: u.int_in_range(0..=10)?,
max_pkg_items: u.int_in_range(0..=10)?,
max_type_parts: u.int_in_range(1..=10)?,
})
}
Expand Down
Loading

0 comments on commit fd8a147

Please sign in to comment.