Uh oh!
There was an error while loading. Please reload this page.
Change the UnixStream interface so that close_write on a variable preven... - #19251
Change the UnixStream interface so that close_write on a variable preven...#19251jbapple wants to merge 3 commits into
Conversation
…vents (at compile time) future attempts to write to that variable. This is also true for close_read. Note that UnixStreams cloned from a variable on which close_* is called are not affected by this change. They have the same interface as before, in which reads and writes may fail due to the underlying stream being closed for that operation.
rust-highfive
commented
Nov 23, 2014
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. |
rust-highfive
commented
Nov 23, 2014
alexcrichton
commented
Nov 24, 2014
This is an interesting idea, thanks for the PR! I have a few concerns with this approach, however:
|
jbapple
commented
Nov 24, 2014
Q: Why not A: I wanted to see if this approach works well first, in no small part based on feedback on this PR. Q: Can't you seesaw back and forth, getting back your read abilities by calling A: I don't think so. Calling Q: Should we hold off due to timeout issues? A: I suspect this change and any timeout changes would interact in a commutative and rather mechanical way, not requiring much thought. |
alexcrichton
commented
Nov 24, 2014
Ah I see how it work! I got lost in the trait impls, clever though! This does have the unfortunate drawback that the API of It may be best to punt this sort of static guarantee to an application writer rather than the standard library itself. I personally expect the |
jbapple
commented
Nov 25, 2014
The duplication is unfortunate, thought relatively small, since the As far as the problems with storing these in a structure goes, this is roughly the same thing one gets from the
|
alexcrichton
commented
Nov 25, 2014
Many methods do indeed operate on
Here this is just an I/O operation which does not actually need to consume the stream by any means. |
jbapple
commented
Nov 26, 2014
I can see that it might require more code to manage the different types of streams in one structure, though I view this cost as worth it. I can appreciate that this view is not the only possible one. Do you have any thoughts on how this sort of static guarantee can be maintained while lessening the burden on a programmer who wants to keep some closed and some open streams in one structure without decorating them as such? |
Conflicts: src/libstd/io/net/pipe.rs
jbapple
commented
Nov 29, 2014
I could add a type that exposes an interface similar to the current one in which |
alexcrichton
commented
Nov 30, 2014
I don't personally have a great idea in mind for how to get this sort of static guarantee, but I'll reference my comment on your other PR for pipes to stress that we need to consider the design of |
jbapple
commented
Nov 30, 2014
Sounds good to me! |
jbapple
commented
Dec 1, 2014
Here's an implementation for TCP streams that uses generics rather than traits: https://github.com/jbapple/rust/compare/affine-tcp?expand=1 I'm not submitting a PR for this at the moment, in order to wait on the |
alexcrichton
commented
Dec 5, 2014
@aturon and I have had taken quite some time to look at |
Remove syntax editing from parenthesis computation
...ts (at compile time) future attempts to write to that variable.
This is also true for close_read.
Note that UnixStreams cloned from a variable on which close_* is called are not affected by this change. They have the same interface as before, in which reads and writes may fail due to the underlying stream being closed for that operation.