Skip to content

Commit

Permalink
Merge pull request #445 from mkrasnitski/clone-error
Browse files Browse the repository at this point in the history
Implement `Clone` for `CompressError` and `DecompressError`
  • Loading branch information
Byron authored Jan 25, 2025
2 parents 9c9236b + c0d2fff commit 15e261a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ffi/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::ptr;
use super::*;
use crate::mem;

#[derive(Default)]
#[derive(Clone, Default)]
pub struct ErrorMessage(Option<&'static str>);

impl ErrorMessage {
Expand Down
2 changes: 1 addition & 1 deletion src/ffi/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::*;
use crate::mem;

// miniz_oxide doesn't provide any error messages (yet?)
#[derive(Default)]
#[derive(Clone, Default)]
pub struct ErrorMessage;

impl ErrorMessage {
Expand Down
6 changes: 3 additions & 3 deletions src/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ pub enum FlushDecompress {
}

/// The inner state for an error when decompressing
#[derive(Debug)]
#[derive(Clone, Debug)]
pub(crate) enum DecompressErrorInner {
General { msg: ErrorMessage },
NeedsDictionary(u32),
}

/// Error returned when a decompression object finds that the input stream of
/// bytes was not a valid input stream of bytes.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct DecompressError(pub(crate) DecompressErrorInner);

impl DecompressError {
Expand Down Expand Up @@ -147,7 +147,7 @@ pub(crate) fn decompress_need_dict<T>(adler: u32) -> Result<T, DecompressError>

/// Error returned when a compression object is used incorrectly or otherwise
/// generates an error.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct CompressError {
pub(crate) msg: ErrorMessage,
}
Expand Down

0 comments on commit 15e261a

Please sign in to comment.