Struct solana_rbpf::ebpf::Insn [−][src]
An eBPF instruction.
See https://www.kernel.org/doc/Documentation/networking/filter.txt for the Linux kernel documentation about eBPF, or https://github.com/iovisor/bpf-docs/blob/master/eBPF.md for a more concise version.
Fields
opc: u8
Operation code.
dst: u8
Destination register operand.
src: u8
Source register operand.
off: i16
Offset operand.
imm: i32
Immediate value operand.
Implementations
impl Insn
[src]
pub fn to_array(&self) -> [u8; 8]
[src]
Turn an Insn
back into an array of bytes.
Examples
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);
pub fn to_vec(&self) -> Vec<u8>
[src]
Turn an Insn
into an vector of bytes.
Examples
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);
Trait Implementations
impl Clone for Insn
[src]
impl Debug for Insn
[src]
impl PartialEq<Insn> for Insn
[src]
impl StructuralPartialEq for Insn
[src]
Auto Trait Implementations
impl RefUnwindSafe for Insn
impl Send for Insn
impl Sync for Insn
impl Unpin for Insn
impl UnwindSafe for Insn
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,