File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515
1616- Updated to stm32-rs v0.6.0 - @HarkonenBade
1717- Updated the ADC code to use variants added in stm32-rs v0.6.0 - @HarkonenBade
18+ - Improved serial ` write_str ` implementation
1819
1920## [ v0.12.0] - 2019-01-13
2021
Original file line number Diff line number Diff line change @@ -518,10 +518,10 @@ where
518518 Tx < USART > : embedded_hal:: serial:: Write < u8 > ,
519519{
520520 fn write_str ( & mut self , s : & str ) -> Result {
521- use nb :: block ;
522-
523- let _ = s . as_bytes ( ) . iter ( ) . map ( |c| block ! ( self . write( * c) ) ) . last ( ) ;
524- Ok ( ( ) )
521+ s . as_bytes ( )
522+ . iter ( )
523+ . try_for_each ( |c| nb :: block!( self . write( * c) ) )
524+ . map_err ( |_| core :: fmt :: Error )
525525 }
526526}
527527
@@ -531,10 +531,10 @@ where
531531 TXPIN : TxPin < USART > ,
532532{
533533 fn write_str ( & mut self , s : & str ) -> Result {
534- use nb :: block ;
535-
536- let _ = s . as_bytes ( ) . iter ( ) . map ( |c| block ! ( self . write( * c) ) ) . last ( ) ;
537- Ok ( ( ) )
534+ s . as_bytes ( )
535+ . iter ( )
536+ . try_for_each ( |c| nb :: block!( self . write( * c) ) )
537+ . map_err ( |_| core :: fmt :: Error )
538538 }
539539}
540540
You can’t perform that action at this time.
0 commit comments