Closed gui1117 closed 2 months ago
I saw some code which tries to track the number of byte read with remaining_len. But remaining_len don't always give information.
remaining_len
I think it is better to provide an accurate counter.
I used u64 because it made the code simpler. And more general purpose.
Otherwise I was thinking using a type:
enum Count { Exact(u32), MaxReached, }
and do the count in u32.
But most machine being 64bit, I think it should execute good.
fyi we also have saturated_inc() which mutates in place and adds one.
saturated_inc()
No in the standard library (which is only used in this crate)
I saw some code which tries to track the number of byte read with
remaining_len
. Butremaining_len
don't always give information.I think it is better to provide an accurate counter.
I used u64 because it made the code simpler. And more general purpose.
Otherwise I was thinking using a type:
and do the count in u32.
But most machine being 64bit, I think it should execute good.