Skip to content

Commit 929dd88

Browse files
authored
Merge pull request #513 from MabezDev/public-slice-write-error
Make `SliceWriteError` publicly accessible
2 parents 454f17f + b2c1c0d commit 929dd88

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

embedded-io/src/impls/slice_mut.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
use crate::{Error, ErrorKind, ErrorType, Write};
1+
use crate::{Error, ErrorKind, ErrorType, SliceWriteError, Write};
22
use core::mem;
33

4-
// needed to prevent defmt macros from breaking, since they emit code that does `defmt::blahblah`.
5-
#[cfg(feature = "defmt-03")]
6-
use defmt_03 as defmt;
7-
8-
/// Errors that could be returned by `Write` on `&mut [u8]`.
9-
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
10-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
11-
#[non_exhaustive]
12-
pub enum SliceWriteError {
13-
/// The target slice was full and so could not receive any new data.
14-
Full,
15-
}
16-
174
impl Error for SliceWriteError {
185
fn kind(&self) -> ErrorKind {
196
match self {

embedded-io/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ impl<E: fmt::Debug> fmt::Display for ReadExactError<E> {
259259
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
260260
impl<E: fmt::Debug> std::error::Error for ReadExactError<E> {}
261261

262+
/// Errors that could be returned by `Write` on `&mut [u8]`.
263+
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
264+
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
265+
#[non_exhaustive]
266+
pub enum SliceWriteError {
267+
/// The target slice was full and so could not receive any new data.
268+
Full,
269+
}
270+
262271
/// Error returned by [`Write::write_fmt`]
263272
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
264273
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]

0 commit comments

Comments
 (0)