Closed hseeberger closed 2 years ago
Not the same when serialised… it is the diff between a json field having an empty array and the fuels not being present.
But is there a semantic difference at the level of Rust code? If not, i.e. if both None and Some(Vec::empty) lead to the program behaving the same way, it would simplify the API if we removed the option and made any needed adjustments for serialization.
Actually, I don't think there is a Vec::empty
function is there? Doesn't the creation of an empty vector always allocate?
Sorry, that was just me using Rust like pseudo code.
If you create an empty Vec, e.g. via Vec::new or Vec![], then its capacity is set to zero and it does not allocate heap memory. See https://doc.rust-lang.org/std/vec/struct.Vec.html#guarantees.
Not sure though how the serialization code creates Vecs.
You're right. I shall change it.
Why not drop the Option? Ain't None and Some(Vec::empty) the same?