mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-04-25 07:12:15 +00:00
Add possibility to use enum Instruction in hash structures
This commit is contained in:
parent
e586a7ac87
commit
c7c2d1f246
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ Cargo.lock
|
|||||||
.vscode
|
.vscode
|
||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
rls
|
rls
|
||||||
|
.idea
|
||||||
|
@ -104,7 +104,7 @@ impl Deserialize for InitExpr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Instruction.
|
/// Instruction.
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub enum Instruction {
|
pub enum Instruction {
|
||||||
Unreachable,
|
Unreachable,
|
||||||
@ -539,14 +539,14 @@ pub enum Instruction {
|
|||||||
TableCopy,
|
TableCopy,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub struct MemArg {
|
pub struct MemArg {
|
||||||
pub align: u8,
|
pub align: u8,
|
||||||
pub offset: u32,
|
pub offset: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub struct BrTableData {
|
pub struct BrTableData {
|
||||||
pub table: Box<[u32]>,
|
pub table: Box<[u32]>,
|
||||||
@ -2780,3 +2780,13 @@ fn display() {
|
|||||||
fn size_off() {
|
fn size_off() {
|
||||||
assert!(::std::mem::size_of::<Instruction>() <= 24);
|
assert!(::std::mem::size_of::<Instruction>() <= 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn instructions_hashset() {
|
||||||
|
use self::Instruction::{Call, Block, Drop};
|
||||||
|
use super::types::{BlockType::Value, ValueType};
|
||||||
|
|
||||||
|
let set: std::collections::HashSet<Instruction> =
|
||||||
|
vec![Call(1), Block(Value(ValueType::I32)), Drop].into_iter().collect();
|
||||||
|
assert_eq!(set.contains(&Drop), true)
|
||||||
|
}
|
||||||
|
@ -92,7 +92,7 @@ impl fmt::Display for ValueType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Block type which is basically `ValueType` + NoResult (to define blocks that have no return type)
|
/// Block type which is basically `ValueType` + NoResult (to define blocks that have no return type)
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
pub enum BlockType {
|
pub enum BlockType {
|
||||||
/// Value-type specified block type
|
/// Value-type specified block type
|
||||||
Value(ValueType),
|
Value(ValueType),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user