From e19030ee4a6575c2e4f30cc475e479ee51b20c34 Mon Sep 17 00:00:00 2001 From: Jonathan Dygert Date: Wed, 7 Aug 2024 11:35:08 -0400 Subject: [PATCH] Derive `Clone` for error types --- ciborium-io/src/lib.rs | 4 ++-- ciborium-ll/src/dec.rs | 2 +- ciborium/src/de/error.rs | 2 +- ciborium/src/ser/error.rs | 2 +- ciborium/src/value/error.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ciborium-io/src/lib.rs b/ciborium-io/src/lib.rs index 30a484d..f5f1f23 100644 --- a/ciborium-io/src/lib.rs +++ b/ciborium-io/src/lib.rs @@ -105,7 +105,7 @@ impl Write for &mut W { /// An error indicating there are no more bytes to read #[cfg(not(feature = "std"))] -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct EndOfFile(()); #[cfg(not(feature = "std"))] @@ -127,7 +127,7 @@ impl Read for &[u8] { /// An error indicating that the output cannot accept more bytes #[cfg(not(feature = "std"))] -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct OutOfSpace(()); #[cfg(not(feature = "std"))] diff --git a/ciborium-ll/src/dec.rs b/ciborium-ll/src/dec.rs index f512901..d815399 100644 --- a/ciborium-ll/src/dec.rs +++ b/ciborium-ll/src/dec.rs @@ -3,7 +3,7 @@ use super::*; use ciborium_io::Read; /// An error that occurred while decoding -#[derive(Debug)] +#[derive(Clone, Debug)] pub enum Error { /// An error occurred while reading bytes /// diff --git a/ciborium/src/de/error.rs b/ciborium/src/de/error.rs index 996aab1..a52461e 100644 --- a/ciborium/src/de/error.rs +++ b/ciborium/src/de/error.rs @@ -6,7 +6,7 @@ use core::fmt::{Debug, Display, Formatter, Result}; use serde::de::{Error as DeError, StdError}; /// An error occurred during deserialization -#[derive(Debug)] +#[derive(Clone, Debug)] pub enum Error { /// An error occurred while reading bytes /// diff --git a/ciborium/src/ser/error.rs b/ciborium/src/ser/error.rs index e908628..7861e3e 100644 --- a/ciborium/src/ser/error.rs +++ b/ciborium/src/ser/error.rs @@ -6,7 +6,7 @@ use core::fmt::{Debug, Display, Formatter, Result}; use serde::ser::{Error as SerError, StdError}; /// An error occurred during serialization -#[derive(Debug)] +#[derive(Clone, Debug)] pub enum Error { /// An error occurred while writing bytes /// diff --git a/ciborium/src/value/error.rs b/ciborium/src/value/error.rs index bcec128..361aa8b 100644 --- a/ciborium/src/value/error.rs +++ b/ciborium/src/value/error.rs @@ -3,7 +3,7 @@ use alloc::string::{String, ToString}; /// The error when serializing to/from a `Value` -#[derive(Debug)] +#[derive(Clone, Debug)] pub enum Error { /// A custom error string produced by serde Custom(String),