I have a graph data structure that uses
u32 for node representation. I have methods like
num_nodes() which I know can't exceed the value range of
u32 because of this. But I frequently need
u32 in contexts that expect a
usize (like when I make a
Vec<u32> with the
with_capacity method that expects a
Should I just change the return type of
usize or keep the constant casting?
As I see it that would be a loss of information because I know
num_nodes() can't exactly return a bigger value, but on the other hand it's kind of inconvenient and
num_nodes() does represent a size, so
usize might be a better fit.