Skip to content

RingBuffer API Suggestions #129

@tertsdiepraam

Description

@tertsdiepraam

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions