Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Consider renaming Buffer::len #1430

Open
emilk opened this issue Mar 11, 2023 · 1 comment
Open

Consider renaming Buffer::len #1430

emilk opened this issue Mar 11, 2023 · 1 comment

Comments

@emilk
Copy link

emilk commented Mar 11, 2023

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
Copy link
Author

emilk commented Aug 15, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant