-
Notifications
You must be signed in to change notification settings - Fork 400
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
Change the way transmit buffer lengths are populated? #258
Comments
Yes. With the signature you suggest, how large the buffer you pass to |
Ah, I see, I forget that some people can use dynamic memory. So it's up to the caller to request exactly as many bytes as their packet is going to end up being... that still seems odd. What about
where the understanding is that the one returned from the closure is the one that represents the number of bytes to transmit. |
What's the point of this change exactly? smoltcp is specifically designed to know the exact number of bytes it's going to transmit upfront. |
Oh. I didn't realize that. Sorry, the documentation on docs.rs is pretty out of date, so I'm trying to work out how to use it all by reading the source, I missed that tidbit. Forget I said anything :-) |
Ah, sorry for that, I should make a release soon. |
So I'm implementing
phy::TxToken
for my board, and it seems really weird to me that the signature is:What this suggests is that the number of bytes populated by the call
f(&mut buf)
is known beforef
is called... which strikes me as wacky. Is there some reason the signature isn'twhere f returns the number of bytes actually populated?
Would you be open to a PR that makes this change?
The text was updated successfully, but these errors were encountered: