Struct lde::OpCode
[−]
[src]
pub struct OpCode(_);
Byte slice representing an opcode.
Methods
impl OpCode
[src]
pub fn read<T: Int>(&self, offset: usize) -> T
[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.
pub fn write<T: Int>(&mut self, offset: usize, val: T) -> &mut OpCode
[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 Eq for OpCode
[src]
impl PartialEq for OpCode
[src]
fn eq(&self, __arg_0: &OpCode) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &OpCode) -> bool
[src]
This method tests for !=
.
impl Hash for OpCode
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'a, T: AsRef<[u8]> + ?Sized> From<&'a T> for &'a OpCode
[src]
impl<'a, T: AsMut<[u8]> + ?Sized> From<&'a mut T> for &'a mut OpCode
[src]
impl<'a> From<&'a OpCode> for &'a [u8]
[src]
impl<'a> From<&'a mut OpCode> for &'a mut [u8]
[src]
impl Deref for OpCode
[src]
type Target = [u8]
The resulting type after dereferencing.
fn deref(&self) -> &[u8]
[src]
Dereferences the value.
impl DerefMut for OpCode
[src]
impl<T: AsRef<[u8]> + ?Sized> PartialEq<T> for OpCode
[src]
fn eq(&self, other: &T) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Display for OpCode
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more