Skip to content

Commit e6d575a

Browse files
committed
implemented Copy and Clone for CodecError
1 parent 96ab3b1 commit e6d575a

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [0.3.4] - 2025-11-19
7+
8+
- `CodecError` now is `Copy` and/or `Clone` if the encompassing codec errors are `Copy` and/or `Clone` respectively.
9+
10+
611
## [0.3.3] - 2025-10-08
712

813
### New Codecs

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "codee"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
edition = "2021"
55
categories = ["encoding"]
66
description = "Easy and flexible way of encoding and decoding data into either strings or bytes"

src/error.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,23 @@ pub enum CodecError<E, D> {
77
#[error("failed to decode: {0}")]
88
Decode(D),
99
}
10+
11+
impl<E, D> Clone for CodecError<E, D>
12+
where
13+
E: Clone,
14+
D: Clone,
15+
{
16+
fn clone(&self) -> Self {
17+
match self {
18+
CodecError::Encode(e) => CodecError::Encode(e.clone()),
19+
CodecError::Decode(d) => CodecError::Decode(d.clone()),
20+
}
21+
}
22+
}
23+
24+
impl<E, D> Copy for CodecError<E, D>
25+
where
26+
E: Copy,
27+
D: Copy,
28+
{
29+
}

0 commit comments

Comments
 (0)