Vector Length is uSize

I am trying to get the length of a vector so I can carry out the following operation:

let diff = instances.len() - r; 

However, instances.len() is a usize, while r is a u64. I tried doing:


But that didn't work either. Is there some way to get an integer value for the vector length, or do I need to manually create a method to loop through the vector to find its length?
Thanks for your time and help.

instances.len() as u64 - r

^-- Does this work ?

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.