Skip to content

Commit f04beb5

Browse files
committed
io: remove adapters from main crate.
1 parent 3a4814f commit f04beb5

File tree

3 files changed

+33
-201
lines changed

3 files changed

+33
-201
lines changed

embedded-io/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Add `From` impls to convert between `ErrorKind` and `std::io::ErrorKind`.
1313
- Moved `embedded_io::blocking` to the crate root.
1414
- Split async traits to the `embedded-io-async` crate.
15-
- Split async trait adapters to separate crates.
15+
- Split trait adapters to the `embedded-io-adapters` crate.
1616
- Rename trait `Io` to `ErrorKind`, for consistency with `embedded-hal`.
1717

1818
## 0.4.0 - 2022-11-25

embedded-io/src/adapters.rs

-197
This file was deleted.

embedded-io/src/lib.rs

+32-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ use core::fmt;
88
#[cfg(feature = "alloc")]
99
extern crate alloc;
1010

11-
#[cfg(feature = "std")]
12-
pub mod adapters;
13-
1411
mod impls;
1512

1613
/// Enumeration of possible methods to seek within an I/O object.
@@ -26,6 +23,30 @@ pub enum SeekFrom {
2623
Current(i64),
2724
}
2825

26+
#[cfg(feature = "std")]
27+
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
28+
impl From<SeekFrom> for std::io::SeekFrom {
29+
fn from(pos: SeekFrom) -> Self {
30+
match pos {
31+
SeekFrom::Start(n) => std::io::SeekFrom::Start(n),
32+
SeekFrom::End(n) => std::io::SeekFrom::End(n),
33+
SeekFrom::Current(n) => std::io::SeekFrom::Current(n),
34+
}
35+
}
36+
}
37+
38+
#[cfg(feature = "std")]
39+
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
40+
impl From<std::io::SeekFrom> for SeekFrom {
41+
fn from(pos: std::io::SeekFrom) -> SeekFrom {
42+
match pos {
43+
std::io::SeekFrom::Start(n) => SeekFrom::Start(n),
44+
std::io::SeekFrom::End(n) => SeekFrom::End(n),
45+
std::io::SeekFrom::Current(n) => SeekFrom::Current(n),
46+
}
47+
}
48+
}
49+
2950
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
3051
#[non_exhaustive]
3152
/// Possible kinds of errors.
@@ -165,6 +186,14 @@ impl Error for ErrorKind {
165186
}
166187
}
167188

189+
#[cfg(feature = "std")]
190+
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
191+
impl crate::Error for std::io::Error {
192+
fn kind(&self) -> crate::ErrorKind {
193+
self.kind().into()
194+
}
195+
}
196+
168197
/// Base trait for all IO traits, defining the error type.
169198
///
170199
/// All IO operations of all traits return the error defined in this trait.

0 commit comments

Comments
 (0)