0.1.0 |
|
---|
#5 in #determined
13KB
202 行
DYN-PRODUCT
一个创建运行时确定大小的笛卡尔积的crate。
如果大小在编译时确定,则最好使用 itertools::iproduct!
。
用法
将依赖项添加到您的 Cargo.toml
。
[dependencies]
dyn-product = "0.1"
示例
use dyn_product::DynProduct;
let data = vec![
vec!["GroupA-1", "GroupA-2", "GroupA-3"],
vec!["GroupB-1", "GroupB-2"],
vec!["GroupC-1", "GroupC-2", "GroupC-3", "GroupC-4"],
];
for item in DynProduct::from(&data) {
println!("{:?}", item);
}
输出
["GroupA-1", "GroupB-1", "GroupC-1"]
["GroupA-1", "GroupB-1", "GroupC-2"]
["GroupA-1", "GroupB-1", "GroupC-3"]
["GroupA-1", "GroupB-1", "GroupC-4"]
["GroupA-1", "GroupB-2", "GroupC-1"]
["GroupA-1", "GroupB-2", "GroupC-2"]
["GroupA-1", "GroupB-2", "GroupC-3"]
["GroupA-1", "GroupB-2", "GroupC-4"]
["GroupA-2", "GroupB-1", "GroupC-1"]
["GroupA-2", "GroupB-1", "GroupC-2"]
["GroupA-2", "GroupB-1", "GroupC-3"]
["GroupA-2", "GroupB-1", "GroupC-4"]
["GroupA-2", "GroupB-2", "GroupC-1"]
["GroupA-2", "GroupB-2", "GroupC-2"]
["GroupA-2", "GroupB-2", "GroupC-3"]
["GroupA-2", "GroupB-2", "GroupC-4"]
["GroupA-3", "GroupB-1", "GroupC-1"]
["GroupA-3", "GroupB-1", "GroupC-2"]
["GroupA-3", "GroupB-1", "GroupC-3"]
["GroupA-3", "GroupB-1", "GroupC-4"]
["GroupA-3", "GroupB-2", "GroupC-1"]
["GroupA-3", "GroupB-2", "GroupC-2"]
["GroupA-3", "GroupB-2", "GroupC-3"]
["GroupA-3", "GroupB-2", "GroupC-4"]