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

Improve Buf / BufMut docs #178

Open
carllerche opened this issue Jan 18, 2018 · 3 comments
Open

Improve Buf / BufMut docs #178

carllerche opened this issue Jan 18, 2018 · 3 comments

Comments

@carllerche
Copy link
Member

It is not clear how these traits should be implemented when the byte storage is not in continuous memory.

@StanislavGlebik
Copy link

Yeah, we just run into an issue. For our datastructure that's not in continuous memory we implemented Buf trait. Each of the continuous pieces of this datastructure can be empty, and so Buf::bytes() might be empty. But if it happens that get_u8() is called when Buf::bytes() returns an empty slice then it panics i.e. get_u8() doesn't check if a slice is empty or not

@carllerche
Copy link
Member Author

Do you have thoughts on how to improve the docs? I would ❤️ a PR.

@StanislavGlebik
Copy link

Well, I have thoughts on the issue I encountered. In that particular case it's either a documentation issue because docs do not highlight that bytes() should not return an empty slice, or a problem in the code because get_*8 do not check if bytes() are empty. I'm happy to send a PR. IMHO, the latter solution is better.

For the BufMut @jsgf might have opinions on that.

@carllerche carllerche added this to the v0.6 milestone Oct 16, 2020
@carllerche carllerche removed this from the v0.6 milestone Dec 15, 2020
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

2 participants