You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is really a question more than an issue:
Could we remove the RingBuf Reader and Writer newtypes (and implement Buf and MutBuf directly on RingBuf)? I don't actually understand what purpose they have, apart from disambiguating method names from Buf and MutBuf (but that could be done in other ways).
If we could get rid of them, that would massively improve the ergonomics of RingBuf, at least for my use case. There are two problems that I have with them:
There are about a dozen instances in my code where I have to write something along the lines of let r = buf.reader(); let s = r.bytes(); where I would like to write let s = buf.bytes() instead. (Writing let s = buf.reader().bytes() doesn't work because the returned reader would not live long enough). This is admittedly only a minor annoyance.
More importantly, I have a struct containing a RingBuf and I would like to implement a method returning a slice into that RingBuf. I can't do that, though, since the slice I want to return cannot outlive the RingBufReader that I have to create in that method. This is a bigger problem than the first one, since I don't think I can work around it.
I'd be interested in an explanation of the necessity of the newtypes or any thoughts you have on the subject. If you think we could get rid of them, I'd be happy to do the implementation work.
The text was updated successfully, but these errors were encountered:
This is really a question more than an issue:
Could we remove the RingBuf Reader and Writer newtypes (and implement
Buf
andMutBuf
directly onRingBuf
)? I don't actually understand what purpose they have, apart from disambiguating method names fromBuf
andMutBuf
(but that could be done in other ways).If we could get rid of them, that would massively improve the ergonomics of
RingBuf
, at least for my use case. There are two problems that I have with them:let r = buf.reader(); let s = r.bytes();
where I would like to writelet s = buf.bytes()
instead. (Writinglet s = buf.reader().bytes()
doesn't work because the returned reader would not live long enough). This is admittedly only a minor annoyance.RingBufReader
that I have to create in that method. This is a bigger problem than the first one, since I don't think I can work around it.I'd be interested in an explanation of the necessity of the newtypes or any thoughts you have on the subject. If you think we could get rid of them, I'd be happy to do the implementation work.
The text was updated successfully, but these errors were encountered: