Closed cole-miller closed 3 years ago
Is this change possible to do in a backwards-compatible way with the semver trick? I'm afraid that because it modifies an inherent method, it can't be :(
I can't see how to do it... I guess another option would be to initially add these as new methods (iter_ref
or whatever) and deprecate iter
, then complete the shift somewhere down the line.
While we're talking about these methods, I was wondering -- how often is RGBA::iter
useful? I'm hardly an expert but it seems to me like you'd usually want to treat the alpha channel separately.
This PR rewrites the
iter
methods onRGB<T>
andRGBA<T>
to return a custom iterator over&T
, rather than casting to a slice and then cloning each value. This is in line with the typical behavior of methods namediter
e.g. in the standard library. In the common case whereT: Copy
you can adapt to this change just by inserting.copied()
. As a result, these methods no longer require constrainingT
.I also fixed the tests in
src/lib.rs
.This is a breaking API change and could perhaps be folded into a 1.0 release.