Struct lde::OcBuilder [] [src]

pub struct OcBuilder { /* fields omitted */ }

Opcode builder.

Conveniently write new opcodes by their byte representation.

Methods

impl OcBuilder
[src]

[src]

Create a new opcode of specified length, clamped to 15.

The opcode is initialized to all zeroes.

[src]

Helps writing immediate and displacement values.

Examples

let result = lde::OcBuilder::from(b"\xE8****").write(1, 0x01010101_u32);
assert_eq!(*result, b"\xE8\x01\x01\x01\x01");

Panics

Panics if offset..offset + sizeof(T) is out of bounds.

Methods from Deref<Target = OpCode>

[src]

Helps reading immediate and displacement values.

Examples

// mov eax, 0x01010101
let opcode: &lde::OpCode = b"\xB8\x01\x01\x01\x01".into();

// reads the immedate value
let result = opcode.read::<u32>(1);

assert_eq!(result, 0x01010101);

Panics

Panics if offset..offset + sizeof(T) is out of bounds.

[src]

Helps writing immediate and displacement values.

Examples

// mov al, 1
let mut opcode = [0xb0, 0x01];
let opcode: &mut lde::OpCode = (&mut opcode).into();

// change the immediate to 0xff
opcode.write(1, 0xff_u8);

assert_eq!(opcode, &[0xb0, 0xff]);

Panics

Panics if offset..offset + sizeof(T) is out of bounds.

Trait Implementations

impl Copy for OcBuilder
[src]

impl Clone for OcBuilder
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for OcBuilder
[src]

[src]

Returns the "default value" for a type. Read more

impl Eq for OcBuilder
[src]

impl PartialEq for OcBuilder
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Hash for OcBuilder
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: AsRef<[u8]>> From<T> for OcBuilder
[src]

Converts a template byte slice to an opcode builder.

The input length is clamped to 15 bytes.

[src]

Performs the conversion.

impl Deref for OcBuilder
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

impl DerefMut for OcBuilder
[src]

[src]

Mutably dereferences the value.

impl Debug for OcBuilder
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for OcBuilder
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for OcBuilder

impl Sync for OcBuilder