Skip to content

Commit

Permalink
Merge pull request #311 from philipc/issue-310
Browse files Browse the repository at this point in the history
Derive more traits for `FileKind` and other enums
  • Loading branch information
philipc committed May 30, 2021
2 parents a369a0d + d10ea5a commit 309ee22
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub enum BinaryFormat {
}

/// The kind of a section.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum SectionKind {
/// The section kind is unknown.
Expand Down Expand Up @@ -185,7 +185,7 @@ impl SectionKind {
///
/// This determines the way in which the linker resolves multiple definitions of the COMDAT
/// sections.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ComdatKind {
/// The selection kind is unknown.
Expand Down Expand Up @@ -217,7 +217,7 @@ pub enum ComdatKind {
}

/// The kind of a symbol.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum SymbolKind {
/// The symbol kind is unknown.
Expand All @@ -239,7 +239,7 @@ pub enum SymbolKind {
}

/// A symbol scope.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SymbolScope {
/// Unknown scope.
Unknown,
Expand All @@ -266,7 +266,7 @@ pub enum SymbolScope {
/// * Section - The address of the section containing the symbol.
///
/// 'XxxRelative' means 'Xxx + A - P'. 'XxxOffset' means 'S + A - Xxx'.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum RelocationKind {
/// S + A
Expand Down Expand Up @@ -306,7 +306,7 @@ pub enum RelocationKind {
///
/// This is usually architecture specific, such as specifying an addressing mode or
/// a specific instruction.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum RelocationEncoding {
/// Generic encoding.
Expand Down Expand Up @@ -336,7 +336,7 @@ pub enum RelocationEncoding {
}

/// File flags that are specific to each file format.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum FileFlags {
/// No file flags.
Expand All @@ -359,7 +359,7 @@ pub enum FileFlags {
}

/// Section flags that are specific to each file format.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum SectionFlags {
/// No section flags.
Expand All @@ -382,7 +382,7 @@ pub enum SectionFlags {
}

/// Symbol flags that are specific to each file format.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum SymbolFlags<Section> {
/// No symbol flags.
Expand Down
2 changes: 1 addition & 1 deletion src/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub type NativeFile<'data, R = &'data [u8]> = pe::PeFile64<'data, R>;
pub type NativeFile<'data, R = &'data [u8]> = wasm::WasmFile<'data, R>;

/// An object file kind.
#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum FileKind {
/// A Unix archive.
Expand Down
2 changes: 1 addition & 1 deletion src/write/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ pub struct Comdat {
}

/// The symbol name mangling scheme.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Mangling {
/// No symbol mangling.
Expand Down

0 comments on commit 309ee22

Please sign in to comment.