Я пытаюсь сгенерировать все комбинации диапазона дат, используя Rust itertools , но он говорит, что границы признаков не были выполнены.
extern crate chrono;
extern crate itertools;
use itertools::Itertools;
use chrono::prelude::*;
fn main() {
let min = NaiveDate::from_ymd(2018, 10, 1);
let max = NaiveDate::from_ymd(2018, 10, 14);
let combinations = (min..=max).combinations(5);
}
Сообщение об ошибке:
error[E0599]: no method named `combinations` found for type `std::ops::RangeInclusive<chrono::NaiveDate>` in the current scope
--> src/main.rs:46:36
|
46 | let combinations = (min..=max).combinations(5);
| ^^^^^^^^^^^^
|
= note: the method `combinations` exists but the following trait bounds were not satisfied:
`std::ops::RangeInclusive<chrono::NaiveDate> : itertools::Itertools`
`&std::ops::RangeInclusive<chrono::NaiveDate> : itertools::Itertools`
`&mut std::ops::RangeInclusive<chrono::NaiveDate> : itertools::Itertools`
Я ожидаю, что Itertools
были реализованы для универсального RangeInclusive
.Я изучаю Rust, поэтому я могу упустить что-то очевидное.