-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow an AffineTransform to be constructed from a borrowed array #1105
base: main
Are you sure you want to change the base?
Conversation
That's not a slice, is it? |
Well this is embarrassing |
5eb4ae0
to
433360c
Compare
how about now? |
Better. This could probably be Still, as prior art, |
I actually tried this but got the annoying |
I meant impl<T: CoordNum, A: AsRef<[T; 6]>> From<A> for AffineTransform<T> {
fn from(arr: A) -> Self {
let arr = arr.as_ref();
Self::new(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5])
}
} This would subsume both existing implementations ( But as I mentioned, I don't think it's necessary. Do you have some example where it helps? Because the following already works today: fn foo(arr: &[f64; 6]) {
let _tr = AffineTransform::from(*arr);
} |
Only in avoiding the *, which was annoying me… |
But maybe your AsRef is the way to go. |
Dunno, if |
Fair. |
CHANGES.md
if knowledge of this change could be valuable to users."borrowed array" was formerly "slice", which was wrong!