In #rustlang, I'm zipping two arrays to get an iter of tuples, but it's coming out as (&i32,&i32) and I really want (usize,usize) so I can use those as array indexes. Is there a way to do this without explicitly doing "myarr[*x as usize][*y as usize]" ?
-
-
Yeah I think that's what's doing it. Still won't give me the automatic typecast, but at least I don't have to deref.
-
map(|(a, b)| (*a as usize, *b as usize)) ahead of your indexing? Doesn't eliminate typing out the deref and widen but at least it moves into its own thing
- 1 more reply
New conversation -
-
-
Can we get something like .copied() that would only work with Copy types? Then one could make sure they don’t accidentally clone expensive things, e.g. in generic code.
-
I think it's super confusing to have clone + copy in the same language. In Rust it's okay because Copy only means that the object can be cloned instead of move. The compiler teach you that. But when you have 2 methods: copy & clone, I find it confusing
- 8 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.