pub struct Insn {
pub opc: u8,
pub dst: u8,
pub src: u8,
pub off: i16,
pub imm: i32,
}
Destination register operand.
Turn an Insn
back into an array of bytes.
use solana_rbpf::ebpf;
let prog: &[u8] = &[
0xb7, 0x12, 0x56, 0x34, 0xde, 0xbc, 0x9a, 0x78,
];
let insn = ebpf::Insn {
opc: 0xb7,
dst: 2,
src: 1,
off: 0x3456,
imm: 0x789abcde
};
assert_eq!(insn.to_array(), prog);
Turn an Insn
into an vector of bytes.
use solana_rbpf::ebpf;
let prog: Vec<u8> = vec![
0xb7, 0x12, 0x56, 0x34, 0xde, 0xbc, 0x9a, 0x78,
];
let insn = ebpf::Insn {
opc: 0xb7,
dst: 2,
src: 1,
off: 0x3456,
imm: 0x789abcde
};
assert_eq!(insn.to_vec(), prog);
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more