Skip to content

Commit bf1ef7f

Browse files
committed
Move the portability traits into Future Possibilities too.
1 parent 6854c4d commit bf1ef7f

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

text/0000-io-safety.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,6 @@ pub fn do_some_io<FD: AsFd>(input: &FD) -> io::Result<()> {
161161

162162
For Windows, similar traits, but in `Handle` and `Socket` forms.
163163

164-
## Portability for simple use cases
165-
166-
Portability in this space isn't easy, since Windows has two different handle
167-
types while Unix has one. However, some use cases can treat `AsFd` and
168-
`AsHandle` similarly, while some other uses can treat `AsFd` and `AsSocket`
169-
similarly. In these two cases, trivial `Filelike` and `Socketlike` abstractions
170-
allow code which works in this way to be generic over Unix and Windows.
171-
172-
On Unix, `AsFilelike` and `AsSocketlike` have blanket implementations for
173-
any type that implements `AsFd`. On Windows, `AsFilelike` has a blanket
174-
implementation for any type that implements `AsHandle`, and `AsSocketlike`
175-
has a blanket implementation for any type that implements `AsSocket`.
176-
177-
Similar portability abstractions apply to the `From*` and `Into*` traits.
178-
179164
## Gradual adoption
180165

181166
I/O safety and the new types and traits wouldn't need to be adopted
@@ -387,6 +372,15 @@ Some possible future ideas that could build on this RFC include:
387372
allowing users to "view" a raw file descriptor as a `File`, `TcpStream`,
388373
and so on.
389374

375+
- Portability for simple use cases. Portability in this space isn't easy,
376+
since Windows has two different handle types while Unix has one. However,
377+
some use cases can treat `AsFd` and `AsHandle` similarly, while some other
378+
uses can treat `AsFd` and `AsSocket` similarly. In these two cases, trivial
379+
`Filelike` and `Socketlike` abstractions could allow code which works in
380+
this way to be generic over Unix and Windows.
381+
382+
Similar portability abstractions could apply to the `From*` and `Into*` traits.
383+
390384
# Thanks
391385
[thanks]: #thanks
392386

0 commit comments

Comments
 (0)