Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/egregius313/product-with-repeat.rs
Crate for creating Cartesian products
https://github.com/egregius313/product-with-repeat.rs
Last synced: about 2 months ago
JSON representation
Crate for creating Cartesian products
- Host: GitHub
- URL: https://github.com/egregius313/product-with-repeat.rs
- Owner: egregius313
- Created: 2024-07-14T00:32:30.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T15:34:44.000Z (5 months ago)
- Last Synced: 2024-07-28T16:55:49.113Z (5 months ago)
- Language: Rust
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `product-with-repeat`
Provides the trait `ProductWithRepeat`, which has a single method:
`product_with_repeat`.```rust
use product_with_repeat::ProductWithRepeat;let numbers = vec![0, 1, 2, 3];
assert_eq!(
numbers.product_with_repeat(3).collect::>,
vec![
vec![&0, &0, &0], vec![&0, &0, &1], vec![&0, &0, &2], vec![&0, &0, &3],
vec![&0, &1, &0], vec![&0, &1, &1], vec![&0, &1, &2], vec![&0, &1, &3],
vec![&0, &2, &0], vec![&0, &2, &1], vec![&0, &2, &2], vec![&0, &2, &3],
vec![&0, &3, &0], vec![&0, &3, &1], vec![&0, &3, &2], vec![&0, &3, &3],vec![&1, &0, &0], vec![&1, &0, &1], vec![&1, &0, &2], vec![&1, &0, &3],
vec![&1, &1, &0], vec![&1, &1, &1], vec![&1, &1, &2], vec![&1, &1, &3],
vec![&1, &2, &0], vec![&1, &2, &1], vec![&1, &2, &2], vec![&1, &2, &3],
vec![&1, &3, &0], vec![&1, &3, &1], vec![&1, &3, &2], vec![&1, &3, &3],vec![&2, &0, &0], vec![&2, &0, &1], vec![&2, &0, &2], vec![&2, &0, &3],
vec![&2, &1, &0], vec![&2, &1, &1], vec![&2, &1, &2], vec![&2, &1, &3],
vec![&2, &2, &0], vec![&2, &2, &1], vec![&2, &2, &2], vec![&2, &2, &3],
vec![&2, &3, &0], vec![&2, &3, &1], vec![&2, &3, &2], vec![&2, &3, &3],
vec![&3, &0, &0], vec![&3, &0, &1], vec![&3, &0, &2], vec![&3, &0, &3],
vec![&3, &1, &0], vec![&3, &1, &1], vec![&3, &1, &2], vec![&3, &1, &3],
vec![&3, &2, &0], vec![&3, &2, &1], vec![&3, &2, &2], vec![&3, &2, &3],
vec![&3, &3, &0], vec![&3, &3, &1], vec![&3, &3, &2], vec![&3, &3, &3],
]
);
```