-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
util: Refactor UdpFramed & add UdpFramedRead/UdpFramedWrite #3086
Conversation
71fd35b
to
bc66878
Compare
8713d09
to
8ad5de8
Compare
I've added some docs & tests to this. It's the same implementation as before just refactored to be more in line with the other types in |
fbd6442
to
bcb5b3e
Compare
Sorry, I haven't gotten around to this because it's so long.. |
const INITIAL_WR_CAPACITY: usize = 8 * 1024; | ||
|
||
impl<C: Decoder + Unpin> Stream for UdpFramed<C> { | ||
impl<C> Stream for UdpFramed<C> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removes Unpin
bound-- is this okay?
pub(crate) const INITIAL_RD_CAPACITY: usize = 64 * 1024; | ||
pub(crate) const INITIAL_WR_CAPACITY: usize = 8 * 1024; | ||
|
||
impl<C, R> Stream for UdpFramedImpl<C, R> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Original Stream
impl for UdpFramed
moved here
Oh, that's fine. It looks like a lot of changes but it mostly just shuffles things around to be similar to I added a few comments to the PR that I wanted to call your attention too, but take your time! |
8e96d88
to
f73c68b
Compare
f73c68b
to
dacfa9f
Compare
Motivation
Framed
has both aFramedRead
andFramedWrite
, it's split up nicely to use the same underlying implementation. This doesn't exist for udpSolution
I basically copied the same style but for
UdpFramed
, so that you can make both a Stream-only or Sink-only. It's not totally cleaned up yet, I wanted to get feedback on if this would be accepted first if I keep working on it.I would love to make the underlying type generic and not
UdpSocket
or have something generic that bounds over types that implementpoll_send
&poll_recv
, but unless you're open to adding such a trait, the type will have to be monomorphic, I think.edit: this builds on #3044 so that needs to be merged first