Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Clone for CompressError and DecompressError #445

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading