jorgecarleitao / arrow2

Transmute-free Rust library to work with the Arrow format
Apache License 2.0
1.06k stars 223 forks source link

Consider renaming `Buffer::len` #1430

Open emilk opened 1 year ago

emilk commented 1 year ago

I was very surprised to learn that Buffer::len returns the number of bytes in the buffer, NOT the number of elements. This is very counter-intuitive and also goes against the docstring for Buffer, which states: The easiest way to think about Buffer<T> is being equivalent to a Arc<Vec<T>>

I suggest deprecating len and adding and adding two new methods, num_bytes and num_elements (or similar).

emilk commented 1 year ago

Digging a bit deeper, it seems like the docstring for Buffer::len is wrong !?