I have a vector that will have a maximum capacity of 256, and sometimes the full capacity will be filled with values, and sometimes some of it will be empty. I know I can use a simple loop to push values on like:
let mut v: Vec<u8> = String::from("test string").as_bytes().to_vec();
for _i in v.len() .. 256 {
v.push(0);
}
but, is this the most efficient way of doing this?
Thanks,
Jeramy