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

write_fixed_all #184

Merged
merged 4 commits into from
Dec 3, 2022
Merged

Conversation

FrankReh
Copy link
Collaborator

Define write_all functions that take fixed buffers.

Adds write_fixed_all for TCP and Unix streams.

Adds write_fixed_all_at for File.

Also adds an example: tcp_listener_fixed_buffers that uses read_fixed and write_fixed_all.

The example is the classic TCP echo server
that in this case can serve up to two connections simultaneously.
The example creates a fixed buffer register with two entries.

The example does not yet use a write_all function for ensuring
everything is written back. It is expected a write_all helper will be
provided later for the write_fixed call.
Define write_all functions that take fixed buffers.

Adds write_fixed_all for TCP and Unix streams.

Adds write_fixed_all_at for File.
@FrankReh FrankReh marked this pull request as ready for review November 25, 2022 15:45
@ollie-etl
Copy link
Contributor

@FrankReh This should also be applicable to udp and (I think) also the zero copy variants

@FrankReh
Copy link
Collaborator Author

@ollie-etl Turns out the UdpSocket can take a write, as it can be connected separately first, so even write_fixed should be defined for the UdpSocket. Just realized that today.

@FrankReh
Copy link
Collaborator Author

@ollie-etl Actually, could you clarify what you meant? An _all option doesn't seem necessary for UDP sockets as the writes have to be all or nothing anyway.

@oliverbunting
Copy link

@FrankReh I meant write_fixed, rather than write_fixed_all.

An explosion in number of methods is occurring. I think the case for a builder API overhaul is growing stronger

@oliverbunting
Copy link

And realised my initial comment was irrelevant. Please disregard

@FrankReh FrankReh merged commit 4b92cdb into tokio-rs:master Dec 3, 2022
@FrankReh FrankReh deleted the frankreh/write_fixed_all branch December 3, 2022 21:52
@mzabaluev mzabaluev mentioned this pull request Dec 4, 2022
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

Successfully merging this pull request may close these issues.

4 participants