Skip to content

Commit e363868

Browse files
Dirbaioeldruin
andcommitted
Apply suggestions from code review
Co-authored-by: Diego Barrios Romero <[email protected]>
1 parent 5df51e5 commit e363868

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

embedded-io/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10-
- Added `ReadReady`, `WriteReady` traits. They allow peeking whether the i/o handle is ready to read/write, so they allow using the traits in a non-blocking way.
10+
- Added `ReadReady`, `WriteReady` traits. They allow peeking whether the I/O handle is ready to read/write, so they allow using the traits in a non-blocking way.
1111
- Moved `embedded_io::blocking` to the crate root.
1212
- Split async traits to the `embedded-io-async` crate.
1313
- Split async trait adapters to separate crates.

embedded-io/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
This project is developed and maintained by the [HAL team](https://github.com/rust-embedded/wg#the-hal-team).
88

9-
IO traits for embedded systems.
9+
Input/Output traits for embedded systems.
1010

1111
Rust's `std::io` traits are not available in `no_std` targets, mainly because `std::io::Error`
1212
requires allocation. This crate contains replacement equivalent traits, usable in `no_std`

embedded-io/src/adapters.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
//! To interoperate with `std::io`, wrap a type in one of these
44
//! adapters.
55
//!
6-
//! There's no separate adapters for Read/ReadBuf/Write traits. Instead, a single
6+
//! There are no separate adapters for `Read`/`ReadBuf`/`Write` traits. Instead, a single
77
//! adapter implements the right traits based on what the inner type implements.
8-
//! This allows adapting a `Read+Write`, for example.
8+
//! This allows using these adapters when using `Read+Write`, for example.
99
1010
use crate::SeekFrom;
1111

@@ -107,26 +107,26 @@ impl<T: ?Sized> ToStd<T> {
107107

108108
impl<T: crate::Read + ?Sized> std::io::Read for ToStd<T> {
109109
fn read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
110-
self.inner.read(buf).map_err(to_io_error)
110+
self.inner.read(buf).map_err(to_std_error)
111111
}
112112
}
113113

114114
impl<T: crate::Write + ?Sized> std::io::Write for ToStd<T> {
115115
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
116-
self.inner.write(buf).map_err(to_io_error)
116+
self.inner.write(buf).map_err(to_std_error)
117117
}
118118
fn flush(&mut self) -> Result<(), std::io::Error> {
119-
self.inner.flush().map_err(to_io_error)
119+
self.inner.flush().map_err(to_std_error)
120120
}
121121
}
122122

123123
impl<T: crate::Seek + ?Sized> std::io::Seek for ToStd<T> {
124124
fn seek(&mut self, pos: std::io::SeekFrom) -> Result<u64, std::io::Error> {
125-
self.inner.seek(pos.into()).map_err(to_io_error)
125+
self.inner.seek(pos.into()).map_err(to_std_error)
126126
}
127127
}
128128

129-
fn to_io_error<T: core::fmt::Debug>(err: T) -> std::io::Error {
129+
fn to_std_error<T: core::fmt::Debug>(err: T) -> std::io::Error {
130130
let kind = std::io::ErrorKind::Other;
131131
std::io::Error::new(kind, format!("{:?}", err))
132132
}

embedded-io/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ pub trait ReadReady: crate::Io {
281281
/// This allows using a [`Write`] in a nonblocking fashion, i.e. trying to write
282282
/// only when it is ready.
283283
pub trait WriteReady: crate::Io {
284-
/// Get whether the writer is ready for immediately writeing.
284+
/// Get whether the writer is ready for immediately writing.
285285
///
286286
/// This usually means that there is free space in the internal transmit buffer.
287287
///

0 commit comments

Comments
 (0)