Skip to content

Commit

Permalink
Make SliceWriteError publicly accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev committed Oct 18, 2023
1 parent 454f17f commit aa9d2c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
11 changes: 1 addition & 10 deletions embedded-io/src/impls/slice_mut.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
use crate::{Error, ErrorKind, ErrorType, Write};
use crate::{Error, ErrorKind, ErrorType, SliceWriteError, Write};
use core::mem;

// needed to prevent defmt macros from breaking, since they emit code that does `defmt::blahblah`.
#[cfg(feature = "defmt-03")]
use defmt_03 as defmt;

/// Errors that could be returned by `Write` on `&mut [u8]`.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
#[non_exhaustive]
pub enum SliceWriteError {
/// The target slice was full and so could not receive any new data.
Full,
}

impl Error for SliceWriteError {
fn kind(&self) -> ErrorKind {
match self {
Expand Down
9 changes: 9 additions & 0 deletions embedded-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ impl<E: fmt::Debug> fmt::Display for ReadExactError<E> {
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl<E: fmt::Debug> std::error::Error for ReadExactError<E> {}

/// Errors that could be returned by `Write` on `&mut [u8]`.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
#[non_exhaustive]
pub enum SliceWriteError {
/// The target slice was full and so could not receive any new data.
Full,
}

/// Error returned by [`Write::write_fmt`]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
Expand Down

0 comments on commit aa9d2c6

Please sign in to comment.