Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RingBuffer API Suggestions #129

Open
1 of 4 tasks
tertsdiepraam opened this issue Sep 24, 2023 · 0 comments
Open
1 of 4 tasks

RingBuffer API Suggestions #129

tertsdiepraam opened this issue Sep 24, 2023 · 0 comments

Comments

@tertsdiepraam
Copy link
Contributor

tertsdiepraam commented Sep 24, 2023

I took a look at the API of the RingBuffer trait and I have some suggestions for cleanup before 1.0. Happy to make a PR for whatever subset of these changes you want (except the second one, I'd need to investigate that with one of you to fully figure that out):

  • Swap push and enqueue. Since dequeue is a required method on RingBuffer, is makes sense that enqueue would be the required method and push the provided one.
  • len being provided is a bit confusing, because there's no way it can be derived from the required methods, at least not from the methods that show up in the docs. Something you might consider is splitting RingBuffer from UnsafeRingBuffer or something and "hide" methods that way, while still making it possible to see what's going on in the docs. Ideally though, the ptr_* methods would only be an implementation detail and should maybe not be part of the trait.
  • get_signed can probably be a provided method, based on length and get.
  • skip seems like it could be removed, because the drop can be done manually.
@tertsdiepraam tertsdiepraam changed the title API Suggestions RingBuffer API Suggestions Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant