Closed
Description
I wanted to look into implementing these traits for Iterator
s, but taking &self
makes that a little difficult. With the current traits there isn't a convenient way to implement the following blanket impl:
impl<T: FloatDiff, I: IntoIterator<Item=T>> FloatDiff for I {
type AbsDiff = AbsDiffIter<T::AbsDiff>;
fn abs_diff(&self, other: &Self) -> Self::AbsDiff {
/* can't call self.into_iter() here */
}
/* similar for ulps_diff */
}
My proposed changes:
- Change traits to take
self
f32
,f64
,Complex
remain unchanged since they are allCopy
.- Add blanket impls for
IntoIterator
, returning iterators overAbsDiff
, etc. - Change implementations for
[T; N]
to&[T; N]
(if they are even still necessary, arrays implementIntoIterator
)
Let me know what you think and if you'd like a little help implementing it, I didn't want to go change everything and just drop a PR without bringing it up :)
Metadata
Metadata
Assignees
Labels
No labels