44
55use core:: cmp:: Ordering ;
66use core:: marker;
7- use void:: ResultVoidExt ;
87
98use crate :: port;
109
@@ -62,7 +61,7 @@ impl<CLOCK: crate::clock::Clock> Baudrate<CLOCK> {
6261 Baudrate {
6362 ubrr : ubrr as u16 ,
6463 u2x,
65- _clock : :: core :: marker:: PhantomData ,
64+ _clock : marker:: PhantomData ,
6665 }
6766 }
6867
@@ -73,7 +72,7 @@ impl<CLOCK: crate::clock::Clock> Baudrate<CLOCK> {
7372 Baudrate {
7473 ubrr,
7574 u2x,
76- _clock : :: core :: marker:: PhantomData ,
75+ _clock : marker:: PhantomData ,
7776 }
7877 }
7978
@@ -184,21 +183,21 @@ pub trait UsartOps<H, RX, TX> {
184183 /// was flushed yet.
185184 ///
186185 /// **Warning**: This is a low-level method and should not be called directly from user code.
187- fn raw_flush ( & mut self ) -> nb:: Result < ( ) , void :: Void > ;
186+ fn raw_flush ( & mut self ) -> nb:: Result < ( ) , core :: convert :: Infallible > ;
188187 /// Write a byte to the TX buffer.
189188 ///
190189 /// This operation must be non-blocking and return [`nb::Error::WouldBlock`] until the byte is
191190 /// enqueued. The operation should not wait for the byte to have actually been sent.
192191 ///
193192 /// **Warning**: This is a low-level method and should not be called directly from user code.
194- fn raw_write ( & mut self , byte : u8 ) -> nb:: Result < ( ) , void :: Void > ;
193+ fn raw_write ( & mut self , byte : u8 ) -> nb:: Result < ( ) , core :: convert :: Infallible > ;
195194 /// Read a byte from the RX buffer.
196195 ///
197196 /// This operation must be non-blocking and return [`nb::Error::WouldBlock`] if no incoming
198197 /// byte is available.
199198 ///
200199 /// **Warning**: This is a low-level method and should not be called directly from user code.
201- fn raw_read ( & mut self ) -> nb:: Result < u8 , void :: Void > ;
200+ fn raw_read ( & mut self ) -> nb:: Result < u8 , core :: convert :: Infallible > ;
202201
203202 /// Enable/Disable a certain interrupt.
204203 ///
@@ -220,11 +219,11 @@ pub trait UsartOps<H, RX, TX> {
220219/// 57600.into_baudrate(),
221220/// );
222221///
223- /// ufmt::uwriteln!(&mut serial, "Hello from Arduino!\r").void_unwrap ();
222+ /// ufmt::uwriteln!(&mut serial, "Hello from Arduino!\r").unwrap ();
224223///
225224/// loop {
226- /// let b = nb::block!(serial.read()).void_unwrap ();
227- /// ufmt::uwriteln!(&mut serial, "Got {}!\r", b).void_unwrap ();
225+ /// let b = nb::block!(serial.read()).unwrap ();
226+ /// ufmt::uwriteln!(&mut serial, "Got {}!\r", b).unwrap ();
228227/// }
229228/// ```
230229pub struct Usart < H , USART : UsartOps < H , RX , TX > , RX , TX , CLOCK > {
@@ -279,22 +278,22 @@ impl<H, USART: UsartOps<H, RX, TX>, RX, TX, CLOCK> Usart<H, USART, RX, TX, CLOCK
279278
280279 /// Block until all remaining data has been transmitted.
281280 pub fn flush ( & mut self ) {
282- nb:: block!( self . p. raw_flush( ) ) . void_unwrap ( )
281+ nb:: block!( self . p. raw_flush( ) ) . unwrap ( )
283282 }
284283
285284 /// Transmit a byte.
286285 ///
287286 /// This method will block until the byte has been enqueued for transmission but **not** until
288287 /// it was entirely sent.
289288 pub fn write_byte ( & mut self , byte : u8 ) {
290- nb:: block!( self . p. raw_write( byte) ) . void_unwrap ( )
289+ nb:: block!( self . p. raw_write( byte) ) . unwrap ( )
291290 }
292291
293292 /// Receive a byte.
294293 ///
295294 /// This method will block until a byte could be received.
296295 pub fn read_byte ( & mut self ) -> u8 {
297- nb:: block!( self . p. raw_read( ) ) . void_unwrap ( )
296+ nb:: block!( self . p. raw_read( ) ) . unwrap ( )
298297 }
299298
300299 /// Enable the interrupt for [`Event`].
@@ -336,7 +335,7 @@ impl<H, USART: UsartOps<H, RX, TX>, RX, TX, CLOCK> Usart<H, USART, RX, TX, CLOCK
336335}
337336
338337impl < H , USART : UsartOps < H , RX , TX > , RX , TX , CLOCK > ufmt:: uWrite for Usart < H , USART , RX , TX , CLOCK > {
339- type Error = void :: Void ;
338+ type Error = core :: convert :: Infallible ;
340339
341340 fn write_str ( & mut self , s : & str ) -> Result < ( ) , Self :: Error > {
342341 for b in s. as_bytes ( ) . iter ( ) {
@@ -349,7 +348,7 @@ impl<H, USART: UsartOps<H, RX, TX>, RX, TX, CLOCK> ufmt::uWrite for Usart<H, USA
349348impl < H , USART : UsartOps < H , RX , TX > , RX , TX , CLOCK > hal:: serial:: Write < u8 >
350349 for Usart < H , USART , RX , TX , CLOCK >
351350{
352- type Error = void :: Void ;
351+ type Error = core :: convert :: Infallible ;
353352
354353 fn write ( & mut self , byte : u8 ) -> nb:: Result < ( ) , Self :: Error > {
355354 self . p . raw_write ( byte)
@@ -363,7 +362,7 @@ impl<H, USART: UsartOps<H, RX, TX>, RX, TX, CLOCK> hal::serial::Write<u8>
363362impl < H , USART : UsartOps < H , RX , TX > , RX , TX , CLOCK > hal:: serial:: Read < u8 >
364363 for Usart < H , USART , RX , TX , CLOCK >
365364{
366- type Error = void :: Void ;
365+ type Error = core :: convert :: Infallible ;
367366
368367 fn read ( & mut self ) -> nb:: Result < u8 , Self :: Error > {
369368 self . p . raw_read ( )
@@ -434,11 +433,11 @@ impl<H, USART: UsartOps<H, RX, TX>, RX, TX, CLOCK> UsartReader<H, USART, RX, TX,
434433impl < H , USART : UsartOps < H , RX , TX > , RX , TX , CLOCK > ufmt:: uWrite
435434 for UsartWriter < H , USART , RX , TX , CLOCK >
436435{
437- type Error = void :: Void ;
436+ type Error = core :: convert :: Infallible ;
438437
439438 fn write_str ( & mut self , s : & str ) -> Result < ( ) , Self :: Error > {
440439 for b in s. as_bytes ( ) . iter ( ) {
441- nb:: block!( self . p. raw_write( * b) ) . void_unwrap ( )
440+ nb:: block!( self . p. raw_write( * b) ) . unwrap ( )
442441 }
443442 Ok ( ( ) )
444443 }
@@ -447,7 +446,7 @@ impl<H, USART: UsartOps<H, RX, TX>, RX, TX, CLOCK> ufmt::uWrite
447446impl < H , USART : UsartOps < H , RX , TX > , RX , TX , CLOCK > hal:: serial:: Write < u8 >
448447 for UsartWriter < H , USART , RX , TX , CLOCK >
449448{
450- type Error = void :: Void ;
449+ type Error = core :: convert :: Infallible ;
451450
452451 fn write ( & mut self , byte : u8 ) -> nb:: Result < ( ) , Self :: Error > {
453452 self . p . raw_write ( byte)
@@ -461,7 +460,7 @@ impl<H, USART: UsartOps<H, RX, TX>, RX, TX, CLOCK> hal::serial::Write<u8>
461460impl < H , USART : UsartOps < H , RX , TX > , RX , TX , CLOCK > hal:: serial:: Read < u8 >
462461 for UsartReader < H , USART , RX , TX , CLOCK >
463462{
464- type Error = void :: Void ;
463+ type Error = core :: convert :: Infallible ;
465464
466465 fn read ( & mut self ) -> nb:: Result < u8 , Self :: Error > {
467466 self . p . raw_read ( )
@@ -509,23 +508,23 @@ macro_rules! impl_usart_traditional {
509508 self . [ <ucsr $n b>] . reset( ) ;
510509 }
511510
512- fn raw_flush( & mut self ) -> $crate:: nb:: Result <( ) , $crate :: void :: Void > {
511+ fn raw_flush( & mut self ) -> $crate:: nb:: Result <( ) , core :: convert :: Infallible > {
513512 if self . [ <ucsr $n a>] . read( ) . [ <udre $n>] ( ) . bit_is_clear( ) {
514513 Err ( $crate:: nb:: Error :: WouldBlock )
515514 } else {
516515 Ok ( ( ) )
517516 }
518517 }
519518
520- fn raw_write( & mut self , byte: u8 ) -> $crate:: nb:: Result <( ) , $crate :: void :: Void > {
519+ fn raw_write( & mut self , byte: u8 ) -> $crate:: nb:: Result <( ) , core :: convert :: Infallible > {
521520 // Call flush to make sure the data-register is empty
522521 self . raw_flush( ) ?;
523522
524523 self . [ <udr $n>] . write( |w| unsafe { w. bits( byte) } ) ;
525524 Ok ( ( ) )
526525 }
527526
528- fn raw_read( & mut self ) -> $crate:: nb:: Result <u8 , $crate :: void :: Void > {
527+ fn raw_read( & mut self ) -> $crate:: nb:: Result <u8 , core :: convert :: Infallible > {
529528 if self . [ <ucsr $n a>] . read( ) . [ <rxc $n>] ( ) . bit_is_clear( ) {
530529 return Err ( $crate:: nb:: Error :: WouldBlock ) ;
531530 }
0 commit comments