pub struct Opcodes(/* private fields */);Expand description
Collection of opcodes (usually inside a block section).
Implementations§
Source§impl Opcodes
impl Opcodes
Sourcepub fn elements_mut(&mut self) -> &mut Vec<Opcode>
pub fn elements_mut(&mut self) -> &mut Vec<Opcode>
Individual opcodes, mutable.
Examples found in repository?
examples/inject.rs (line 10)
8pub fn inject_nop(opcodes: &mut elements::Opcodes) {
9 use sophon_wasm::elements::Opcode::*;
10 let opcodes = opcodes.elements_mut();
11 let mut position = 0;
12 loop {
13 let need_inject = match &opcodes[position] {
14 &Block(_) | &If(_) => true,
15 _ => false,
16 };
17 if need_inject {
18 opcodes.insert(position + 1, Nop);
19 }
20
21 position += 1;
22 if position >= opcodes.len() {
23 break;
24 }
25 }
26}Trait Implementations§
Source§impl Deserialize for Opcodes
impl Deserialize for Opcodes
impl StructuralPartialEq for Opcodes
Auto Trait Implementations§
impl Freeze for Opcodes
impl RefUnwindSafe for Opcodes
impl Send for Opcodes
impl Sync for Opcodes
impl Unpin for Opcodes
impl UnwindSafe for Opcodes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more