Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to convert Vec<i64> to Vec<u64>? #338

Answered by 3togo
3togo asked this question in Q&A
Discussion options

How to convert Vec<i64> to Vec<u64>?

You must be logged in to vote

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

Comment options

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);
You must be logged in to vote
2 replies
Comment options

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.

Comment options

@9prady9 ,

many thanks

Eli

Answer selected by 3togo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /