File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,7 @@ description = "Adapters between the `embedded-io` traits and other I/O traits"
7
7
repository = " https://github.com/rust-embedded/embedded-hal"
8
8
readme = " README.md"
9
9
license = " MIT OR Apache-2.0"
10
- categories = [
11
- " embedded" ,
12
- " no-std" ,
13
- ]
10
+ categories = [" embedded" , " no-std" ]
14
11
15
12
[features ]
16
13
std = [" embedded-io/std" ]
Original file line number Diff line number Diff line change 1
1
//! Adapters to/from `std::io` traits.
2
2
3
- use embedded_io:: Error as _;
3
+ use embedded_io:: { Error as _, ReadExactError } ;
4
4
5
5
/// Adapter from `std::io` traits.
6
6
#[ derive( Clone ) ]
@@ -40,6 +40,16 @@ impl<T: std::io::Read + ?Sized> embedded_io::Read for FromStd<T> {
40
40
fn read ( & mut self , buf : & mut [ u8 ] ) -> Result < usize , Self :: Error > {
41
41
self . inner . read ( buf)
42
42
}
43
+
44
+ fn read_exact ( & mut self , buf : & mut [ u8 ] ) -> Result < ( ) , ReadExactError < Self :: Error > > {
45
+ match self . inner . read_exact ( buf) {
46
+ Ok ( ( ) ) => Ok ( ( ) ) ,
47
+ Err ( error) if error. kind ( ) == std:: io:: ErrorKind :: UnexpectedEof => {
48
+ Err ( embedded_io:: ReadExactError :: UnexpectedEof )
49
+ }
50
+ Err ( error) => Err ( error. into ( ) ) ,
51
+ }
52
+ }
43
53
}
44
54
45
55
impl < T : std:: io:: BufRead + ?Sized > embedded_io:: BufRead for FromStd < T > {
You can’t perform that action at this time.
0 commit comments