@@ -45,7 +45,7 @@ async fn net_task(mut runner: embassy_net::Runner<'static, embassy_net_ppp::Devi
4545async fn ppp_task ( stack : Stack < ' static > , mut runner : Runner < ' static > , port : SerialPort ) -> ! {
4646 let port = Async :: new ( port) . unwrap ( ) ;
4747 let port = BufReader :: new ( port) ;
48- let port = adapter :: FromFutures :: new ( port) ;
48+ let port = embedded_io_adapters :: futures_03 :: FromFutures :: new ( port) ;
4949
5050 let config = embassy_net_ppp:: Config {
5151 username : b"myuser" ,
@@ -163,53 +163,3 @@ fn main() {
163163 spawner. spawn ( main_task ( spawner) ) . unwrap ( ) ;
164164 } ) ;
165165}
166-
167- mod adapter {
168- use core:: future:: poll_fn;
169- use core:: pin:: Pin ;
170-
171- use futures:: AsyncBufReadExt ;
172-
173- /// Adapter from `futures::io` traits.
174- #[ derive( Clone ) ]
175- pub struct FromFutures < T : ?Sized > {
176- inner : T ,
177- }
178-
179- impl < T > FromFutures < T > {
180- /// Create a new adapter.
181- pub fn new ( inner : T ) -> Self {
182- Self { inner }
183- }
184- }
185-
186- impl < T : ?Sized > embedded_io_async:: ErrorType for FromFutures < T > {
187- type Error = std:: io:: Error ;
188- }
189-
190- impl < T : futures:: io:: AsyncRead + Unpin + ?Sized > embedded_io_async:: Read for FromFutures < T > {
191- async fn read ( & mut self , buf : & mut [ u8 ] ) -> Result < usize , Self :: Error > {
192- poll_fn ( |cx| Pin :: new ( & mut self . inner ) . poll_read ( cx, buf) ) . await
193- }
194- }
195-
196- impl < T : futures:: io:: AsyncBufRead + Unpin + ?Sized > embedded_io_async:: BufRead for FromFutures < T > {
197- async fn fill_buf ( & mut self ) -> Result < & [ u8 ] , Self :: Error > {
198- self . inner . fill_buf ( ) . await
199- }
200-
201- fn consume ( & mut self , amt : usize ) {
202- Pin :: new ( & mut self . inner ) . consume ( amt)
203- }
204- }
205-
206- impl < T : futures:: io:: AsyncWrite + Unpin + ?Sized > embedded_io_async:: Write for FromFutures < T > {
207- async fn write ( & mut self , buf : & [ u8 ] ) -> Result < usize , Self :: Error > {
208- poll_fn ( |cx| Pin :: new ( & mut self . inner ) . poll_write ( cx, buf) ) . await
209- }
210-
211- async fn flush ( & mut self ) -> Result < ( ) , Self :: Error > {
212- poll_fn ( |cx| Pin :: new ( & mut self . inner ) . poll_flush ( cx) ) . await
213- }
214- }
215- }
0 commit comments