rust-embedded-community / embedded-nal

An Embedded Network Abstraction Layer
Apache License 2.0
177 stars 25 forks source link

Restore feature parity in async TCP #72

Open chrysn opened 2 years ago

chrysn commented 2 years ago

With the embedded-nal-async 0.2.0 release and #70, the -async version of the traits lost feature parity with the sync/nb versions; in particular, missing points are

For closing a connection, it may make sense to replace the current AT type Connection<'m>: embedded_io::asynch::Read<Error = Self::Error> + embedded_io::asynch::Write<Error = Self::Error> [...]; with a dedicated TcpConnection trait, which depends on Read and Write, but in addition requires implementation of a close method.

chrysn commented 2 years ago

The "closing" part may technically not be a regression, as the documentation says that connections are closed when the socket is dropped. This is a bit unusual for TCP connections (on which data can still be received after the sending side having closed it), but consistent with the sync/nb API (which consumes the socket on close, making further reds impossible).