-
Notifications
You must be signed in to change notification settings - Fork 278
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
Add SeekBuf trait and BufCursor implementation #658
base: master
Are you sure you want to change the base?
Conversation
…, remove default pinned impls, and fix some new failing test cases from bugs
…g in cursor chunk_to impl
I'm really sorry that I didn't get around to responding to this when you posted your other feature requests. It's pretty normal to do something like this by taking a You're adding a lot of complex code using indexes in your |
@Darksonn no worries! Thanks for the feedback. This change intends to provide additional functionality for library code that accepts a For example, let's say that I have a method that accepts something along the lines of an As the library maintainer, we have no guarantee how cheap the Since buffers may also be non-contiguous, adding bounds like Outside of I definitely understand that this library is primarily used by Tokio and is provided as a utility with no guarantees that anything beyond the scope of Tokio will be implemented. I also agree that the implementation is quite complex beyond the guarantees of the Rust compiler (this is hopefully well-covered by the added unit tests), so will add a maintenance burden to the project. For my use case, I've settled on maintaining a small fork of this library with the additional functionality that may not be useful for Tokio or other core use-cases of the If you think that there isn't much utility in adding this functionality to this crate, or would prefer not to maintain this code long-term, I would be happy to close this as "won't fix" and retain the scope of my usage to my fork. Thanks again for the review! |
Fixes #657.
This PR introduces the
SeekBuf
trait for buffers that support arbitrary lookups of memory, and a newBufCursor
struct for immutably iterating over aSeekBuf
type.SeekBuf
is strictly an opt-in trait with additional functionality over the standardBuf
trait and otherwise does not change the API of this crate.The
BufCursor
type provides compatibility to a wide range of core/std Rust features through itsIterator
implementation. It also allows recursive and non-consuming access to the full memory of a buffer that was otherwise not possible via theBuf
trait.