-
Couldn't load subscription status.
- Fork 58
-
How to convert Vec<i64> to Vec<u64>?
Beta Was this translation helpful? Give feedback.
All reactions
Answered by
3togo
Aug 31, 2022
Is there any way to avoid using for loop?
let input = ....
let output = Vec::<u64>::new()
for item in input.iter()
output.push(item as u64);
Replies: 1 comment 2 replies
-
Is there any way to avoid using for loop?
let input = ....
let output = Vec::<u64>::new()
for item in input.iter()
output.push(item as u64);
Beta Was this translation helpful? Give feedback.
All reactions
2 replies
-
One way to do that is by doing the following
let y = x.iter().map(|&e| e as u64).collect();
Also, please raise such rust generic questions in stackoverflow or rust forums. These discussions are for arrayfire rust bindings only.
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
Answer selected by
3togo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment