Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
type Date = chrono::Date<chrono::Local>;
pub struct DateIterator {
start: Date,
end: Date
}
impl Iterator for DateIterator {
// ... not important
}
impl DateIterator {
pub fn by_months<'a>(self) -> Groups<'a, u32, DateIterator, fn(&Date) -> u32> {
fn month(d: &Date) -> u32 { d.month() }
self.group_by_lazy(month).into_iter() // <-- ERROR
}
}
// expected `itertools::groupbylazy::Groups<'a, u32, iter::DateIterator, fn(&chrono::date::Date<chrono::offset::local::Local>) -> u32>`,
// found `itertools::groupbylazy::Groups<'_, u32, iter::DateIterator, fn(&chrono::date::Date<chrono::offset::local::Local>) -> u32 {iter::DateIterator::by_months::month}>`
// (expected fn pointer,
// found fn item) [E0308]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment