Skip to content

Commit

Permalink
added eq, partialeq trait for operator equality comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
thesuhas committed Jul 3, 2024
1 parent 6fc1601 commit b6bab20
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/wasmparser/src/binary_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl BinaryReaderError {
}

/// A binary reader of the WebAssembly structures and types.
#[derive(Clone, Debug, Hash)]
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
pub struct BinaryReader<'a> {
buffer: &'a [u8],
position: usize,
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmparser/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ macro_rules! define_wasm_features {

define_wasm_features! {
/// Flags for features that are enabled for validation.
#[derive(Hash, Debug, Copy, Clone)]
#[derive(Hash, Debug, Copy, Clone, Eq, PartialEq)]
pub struct WasmFeatures: u32 {
/// The WebAssembly `mutable-global` proposal.
pub mutable_global: MUTABLE_GLOBAL(1) = true;
Expand Down
10 changes: 5 additions & 5 deletions crates/wasmparser/src/readers/core/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum BlockType {
}

/// Represents a memory immediate in a WebAssembly memory instruction.
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct MemArg {
/// Alignment, stored as `n` where the actual alignment is `2^n`
pub align: u8,
Expand All @@ -57,7 +57,7 @@ pub struct MemArg {
}

/// A br_table entries representation.
#[derive(Clone)]
#[derive(Clone, Eq, PartialEq)]
pub struct BrTable<'a> {
pub(crate) reader: crate::BinaryReader<'a>,
pub(crate) cnt: u32,
Expand Down Expand Up @@ -155,7 +155,7 @@ macro_rules! define_operator {
/// Instructions as defined [here].
///
/// [here]: https://webassembly.github.io/spec/core/binary/instructions.html
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum Operator<'a> {
$(
Expand Down Expand Up @@ -397,7 +397,7 @@ impl<'a, V: VisitOperator<'a> + ?Sized> VisitOperator<'a> for Box<V> {
}

/// A `try_table` entries representation.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TryTable {
/// The block type describing the try block itself.
pub ty: BlockType,
Expand All @@ -406,7 +406,7 @@ pub struct TryTable {
}

/// Catch clauses that can be specified in [`TryTable`].
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum Catch {
/// Equivalent of `catch`
Expand Down

0 comments on commit b6bab20

Please sign in to comment.