Skip to content

Commit 56a2963

Browse files
authored
chore: add clone to instruction and some types (#1487)
Co-authored-by: Sérgio da Gama <[email protected]>
1 parent f772459 commit 56a2963

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

crates/wast/src/core/expr.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ macro_rules! instructions {
349349
}) => (
350350
/// A listing of all WebAssembly instructions that can be in a module
351351
/// that this crate currently parses.
352-
#[derive(Debug)]
352+
#[derive(Debug, Clone)]
353353
#[allow(missing_docs)]
354354
pub enum Instruction<'a> {
355355
$(
@@ -1120,7 +1120,7 @@ impl<'a> Instruction<'a> {
11201120
///
11211121
/// This is used to label blocks and also annotate what types are expected for
11221122
/// the block.
1123-
#[derive(Debug)]
1123+
#[derive(Debug, Clone)]
11241124
#[allow(missing_docs)]
11251125
pub struct BlockType<'a> {
11261126
pub label: Option<Id<'a>>,
@@ -1140,7 +1140,7 @@ impl<'a> Parse<'a> for BlockType<'a> {
11401140
}
11411141
}
11421142

1143-
#[derive(Debug)]
1143+
#[derive(Debug, Clone)]
11441144
#[allow(missing_docs)]
11451145
pub struct TryTable<'a> {
11461146
pub block: Box<BlockType<'a>>,
@@ -1184,7 +1184,7 @@ impl<'a> Parse<'a> for TryTable<'a> {
11841184
}
11851185
}
11861186

1187-
#[derive(Debug)]
1187+
#[derive(Debug, Clone)]
11881188
#[allow(missing_docs)]
11891189
pub enum TryTableCatchKind<'a> {
11901190
// Catch a tagged exception, do not capture an exnref.
@@ -1207,7 +1207,7 @@ impl<'a> TryTableCatchKind<'a> {
12071207
}
12081208
}
12091209

1210-
#[derive(Debug)]
1210+
#[derive(Debug, Clone)]
12111211
#[allow(missing_docs)]
12121212
pub struct TryTableCatch<'a> {
12131213
pub kind: TryTableCatchKind<'a>,
@@ -1216,7 +1216,7 @@ pub struct TryTableCatch<'a> {
12161216

12171217
/// Extra information associated with the `br_table` instruction.
12181218
#[allow(missing_docs)]
1219-
#[derive(Debug)]
1219+
#[derive(Debug, Clone)]
12201220
pub struct BrTableIndices<'a> {
12211221
pub labels: Vec<Index<'a>>,
12221222
pub default: Index<'a>,
@@ -1234,7 +1234,7 @@ impl<'a> Parse<'a> for BrTableIndices<'a> {
12341234
}
12351235

12361236
/// Payload for lane-related instructions. Unsigned with no + prefix.
1237-
#[derive(Debug)]
1237+
#[derive(Debug, Clone)]
12381238
pub struct LaneArg {
12391239
/// The lane argument.
12401240
pub lane: u8,
@@ -1262,7 +1262,7 @@ impl<'a> Parse<'a> for LaneArg {
12621262

12631263
/// Payload for memory-related instructions indicating offset/alignment of
12641264
/// memory accesses.
1265-
#[derive(Debug)]
1265+
#[derive(Debug, Clone)]
12661266
pub struct MemArg<'a> {
12671267
/// The alignment of this access.
12681268
///
@@ -1337,7 +1337,7 @@ impl<'a> MemArg<'a> {
13371337
}
13381338

13391339
/// Extra data associated with the `loadN_lane` and `storeN_lane` instructions.
1340-
#[derive(Debug)]
1340+
#[derive(Debug, Clone)]
13411341
pub struct LoadOrStoreLane<'a> {
13421342
/// The memory argument for this instruction.
13431343
pub memarg: MemArg<'a>,
@@ -1391,7 +1391,7 @@ impl<'a> LoadOrStoreLane<'a> {
13911391
}
13921392

13931393
/// Extra data associated with the `call_indirect` instruction.
1394-
#[derive(Debug)]
1394+
#[derive(Debug, Clone)]
13951395
pub struct CallIndirect<'a> {
13961396
/// The table that this call is going to be indexing.
13971397
pub table: Index<'a>,
@@ -1412,7 +1412,7 @@ impl<'a> Parse<'a> for CallIndirect<'a> {
14121412
}
14131413

14141414
/// Extra data associated with the `table.init` instruction
1415-
#[derive(Debug)]
1415+
#[derive(Debug, Clone)]
14161416
pub struct TableInit<'a> {
14171417
/// The index of the table we're copying into.
14181418
pub table: Index<'a>,
@@ -1434,7 +1434,7 @@ impl<'a> Parse<'a> for TableInit<'a> {
14341434
}
14351435

14361436
/// Extra data associated with the `table.copy` instruction.
1437-
#[derive(Debug)]
1437+
#[derive(Debug, Clone)]
14381438
pub struct TableCopy<'a> {
14391439
/// The index of the destination table to copy into.
14401440
pub dst: Index<'a>,
@@ -1456,7 +1456,7 @@ impl<'a> Parse<'a> for TableCopy<'a> {
14561456
}
14571457

14581458
/// Extra data associated with unary table instructions.
1459-
#[derive(Debug)]
1459+
#[derive(Debug, Clone)]
14601460
pub struct TableArg<'a> {
14611461
/// The index of the table argument.
14621462
pub dst: Index<'a>,
@@ -1474,7 +1474,7 @@ impl<'a> Parse<'a> for TableArg<'a> {
14741474
}
14751475

14761476
/// Extra data associated with unary memory instructions.
1477-
#[derive(Debug)]
1477+
#[derive(Debug, Clone)]
14781478
pub struct MemoryArg<'a> {
14791479
/// The index of the memory space.
14801480
pub mem: Index<'a>,
@@ -1492,7 +1492,7 @@ impl<'a> Parse<'a> for MemoryArg<'a> {
14921492
}
14931493

14941494
/// Extra data associated with the `memory.init` instruction
1495-
#[derive(Debug)]
1495+
#[derive(Debug, Clone)]
14961496
pub struct MemoryInit<'a> {
14971497
/// The index of the data segment we're copying into memory.
14981498
pub data: Index<'a>,
@@ -1514,7 +1514,7 @@ impl<'a> Parse<'a> for MemoryInit<'a> {
15141514
}
15151515

15161516
/// Extra data associated with the `memory.copy` instruction
1517-
#[derive(Debug)]
1517+
#[derive(Debug, Clone)]
15181518
pub struct MemoryCopy<'a> {
15191519
/// The index of the memory we're copying from.
15201520
pub src: Index<'a>,
@@ -1536,7 +1536,7 @@ impl<'a> Parse<'a> for MemoryCopy<'a> {
15361536
}
15371537

15381538
/// Extra data associated with the `struct.get/set` instructions
1539-
#[derive(Debug)]
1539+
#[derive(Debug, Clone)]
15401540
pub struct StructAccess<'a> {
15411541
/// The index of the struct type we're accessing.
15421542
pub r#struct: Index<'a>,
@@ -1554,7 +1554,7 @@ impl<'a> Parse<'a> for StructAccess<'a> {
15541554
}
15551555

15561556
/// Extra data associated with the `array.fill` instruction
1557-
#[derive(Debug)]
1557+
#[derive(Debug, Clone)]
15581558
pub struct ArrayFill<'a> {
15591559
/// The index of the array type we're filling.
15601560
pub array: Index<'a>,
@@ -1569,7 +1569,7 @@ impl<'a> Parse<'a> for ArrayFill<'a> {
15691569
}
15701570

15711571
/// Extra data associated with the `array.copy` instruction
1572-
#[derive(Debug)]
1572+
#[derive(Debug, Clone)]
15731573
pub struct ArrayCopy<'a> {
15741574
/// The index of the array type we're copying to.
15751575
pub dest_array: Index<'a>,
@@ -1587,7 +1587,7 @@ impl<'a> Parse<'a> for ArrayCopy<'a> {
15871587
}
15881588

15891589
/// Extra data associated with the `array.init_[data/elem]` instruction
1590-
#[derive(Debug)]
1590+
#[derive(Debug, Clone)]
15911591
pub struct ArrayInit<'a> {
15921592
/// The index of the array type we're initializing.
15931593
pub array: Index<'a>,
@@ -1605,7 +1605,7 @@ impl<'a> Parse<'a> for ArrayInit<'a> {
16051605
}
16061606

16071607
/// Extra data associated with the `array.new_fixed` instruction
1608-
#[derive(Debug)]
1608+
#[derive(Debug, Clone)]
16091609
pub struct ArrayNewFixed<'a> {
16101610
/// The index of the array type we're accessing.
16111611
pub array: Index<'a>,
@@ -1623,7 +1623,7 @@ impl<'a> Parse<'a> for ArrayNewFixed<'a> {
16231623
}
16241624

16251625
/// Extra data associated with the `array.new_data` instruction
1626-
#[derive(Debug)]
1626+
#[derive(Debug, Clone)]
16271627
pub struct ArrayNewData<'a> {
16281628
/// The index of the array type we're accessing.
16291629
pub array: Index<'a>,
@@ -1641,7 +1641,7 @@ impl<'a> Parse<'a> for ArrayNewData<'a> {
16411641
}
16421642

16431643
/// Extra data associated with the `array.new_elem` instruction
1644-
#[derive(Debug)]
1644+
#[derive(Debug, Clone)]
16451645
pub struct ArrayNewElem<'a> {
16461646
/// The index of the array type we're accessing.
16471647
pub array: Index<'a>,
@@ -1659,7 +1659,7 @@ impl<'a> Parse<'a> for ArrayNewElem<'a> {
16591659
}
16601660

16611661
/// Extra data associated with the `ref.cast` instruction
1662-
#[derive(Debug)]
1662+
#[derive(Debug, Clone)]
16631663
pub struct RefCast<'a> {
16641664
/// The type to cast to.
16651665
pub r#type: RefType<'a>,
@@ -1674,7 +1674,7 @@ impl<'a> Parse<'a> for RefCast<'a> {
16741674
}
16751675

16761676
/// Extra data associated with the `ref.test` instruction
1677-
#[derive(Debug)]
1677+
#[derive(Debug, Clone)]
16781678
pub struct RefTest<'a> {
16791679
/// The type to test for.
16801680
pub r#type: RefType<'a>,
@@ -1689,7 +1689,7 @@ impl<'a> Parse<'a> for RefTest<'a> {
16891689
}
16901690

16911691
/// Extra data associated with the `br_on_cast` instruction
1692-
#[derive(Debug)]
1692+
#[derive(Debug, Clone)]
16931693
pub struct BrOnCast<'a> {
16941694
/// The label to branch to.
16951695
pub label: Index<'a>,
@@ -1710,7 +1710,7 @@ impl<'a> Parse<'a> for BrOnCast<'a> {
17101710
}
17111711

17121712
/// Extra data associated with the `br_on_cast_fail` instruction
1713-
#[derive(Debug)]
1713+
#[derive(Debug, Clone)]
17141714
pub struct BrOnCastFail<'a> {
17151715
/// The label to branch to.
17161716
pub label: Index<'a>,
@@ -1897,7 +1897,7 @@ impl<'a> Parse<'a> for V128Const {
18971897
}
18981898

18991899
/// Lanes being shuffled in the `i8x16.shuffle` instruction
1900-
#[derive(Debug)]
1900+
#[derive(Debug, Clone)]
19011901
pub struct I8x16Shuffle {
19021902
#[allow(missing_docs)]
19031903
pub lanes: [u8; 16],
@@ -1929,7 +1929,7 @@ impl<'a> Parse<'a> for I8x16Shuffle {
19291929
}
19301930

19311931
/// Payload of the `select` instructions
1932-
#[derive(Debug)]
1932+
#[derive(Debug, Clone)]
19331933
pub struct SelectTypes<'a> {
19341934
#[allow(missing_docs)]
19351935
pub tys: Option<Vec<ValType<'a>>>,

0 commit comments

Comments
 (0)