[][src]Struct memflow::types::pointer32::Pointer32

#[repr(transparent)]pub struct Pointer32<T: ?Sized = ()> {
    pub address: u32,
    // some fields omitted
}

This type can be used in structs that are being read from the target memory. It holds a phantom type that can be used to describe the proper type of the pointer and to read it in a more convenient way.

This module is a direct adaption of CasualX's great IntPtr crate.

Generally the generic Type should implement the Pod trait to be read into easily. See here for more information on the Pod trait.

Examples

use memflow::types::Pointer32;
use memflow::mem::VirtualMemory;
use dataview::Pod;

#[repr(C)]
#[derive(Clone, Debug, Pod)]
struct Foo {
    pub some_value: i32,
}

#[repr(C)]
#[derive(Clone, Debug, Pod)]
struct Bar {
    pub foo_ptr: Pointer32<Foo>,
}

fn read_foo_bar<T: VirtualMemory>(virt_mem: &mut T) {
    let bar: Bar = virt_mem.virt_read(0x1234.into()).unwrap();
    let foo = bar.foo_ptr.deref(virt_mem).unwrap();
    println!("value: {}", foo.some_value);
}

use memflow::types::Pointer32;
use memflow::mem::VirtualMemory;
use dataview::Pod;

#[repr(C)]
#[derive(Clone, Debug, Pod)]
struct Foo {
    pub some_value: i32,
}

#[repr(C)]
#[derive(Clone, Debug, Pod)]
struct Bar {
    pub foo_ptr: Pointer32<Foo>,
}

fn read_foo_bar<T: VirtualMemory>(virt_mem: &mut T) {
    let bar: Bar = virt_mem.virt_read(0x1234.into()).unwrap();
    let foo = virt_mem.virt_read_ptr32(bar.foo_ptr).unwrap();
    println!("value: {}", foo.some_value);
}

Fields

address: u32

Implementations

impl<T: ?Sized> Pointer32<T>[src]

pub const NULL: Pointer32<T>[src]

A pointer with a value of zero.

pub fn null() -> Self[src]

Returns a pointer with a value of zero.

pub fn is_null(self) -> bool[src]

Checks wether the containing value of this pointer is zero.

pub const fn into_raw(self) -> u32[src]

Returns the underlying raw u32 value of this pointer.

impl<T: Pod + ?Sized> Pointer32<T>[src]

This function will deref the pointer directly into a Pod type.

pub fn deref_into<U: VirtualMemory>(
    self,
    mem: &mut U,
    out: &mut T
) -> PartialResult<()>
[src]

impl<T: Pod + Sized> Pointer32<T>[src]

This function will return the Object this pointer is pointing towards.

pub fn deref<U: VirtualMemory>(self, mem: &mut U) -> PartialResult<T>[src]

impl<T> Pointer32<[T]>[src]

pub const fn decay(self) -> Pointer32<T>[src]

pub const fn at(self, i: usize) -> Pointer32<T>[src]

Trait Implementations

impl<T> Add<usize> for Pointer32<T>[src]

type Output = Pointer32<T>

The resulting type after applying the + operator.

impl<T: ?Sized> AsMut<u32> for Pointer32<T>[src]

impl<T: ?Sized> AsRef<u32> for Pointer32<T>[src]

impl<T: ?Sized + 'static> ByteSwap for Pointer32<T>[src]

impl<T: ?Sized> Clone for Pointer32<T>[src]

impl<T: ?Sized> Copy for Pointer32<T>[src]

impl<T: ?Sized> Debug for Pointer32<T>[src]

impl<T: ?Sized> Default for Pointer32<T>[src]

impl<T: ?Sized> Display for Pointer32<T>[src]

impl<T: ?Sized> Eq for Pointer32<T>[src]

impl<T: ?Sized> From<Pointer32<T>> for Address[src]

impl<T: ?Sized> From<Pointer32<T>> for u32[src]

impl<T: ?Sized> From<u32> for Pointer32<T>[src]

impl<T: ?Sized> Hash for Pointer32<T>[src]

impl<T: ?Sized> LowerHex for Pointer32<T>[src]

impl<T: ?Sized> Ord for Pointer32<T>[src]

impl<T: ?Sized> PartialEq<Pointer32<T>> for Pointer32<T>[src]

impl<T: ?Sized> PartialOrd<Pointer32<T>> for Pointer32<T>[src]

impl<T: ?Sized + 'static> Pod for Pointer32<T>[src]

impl<T: ?Sized> Serialize for Pointer32<T>[src]

impl<T> Sub<usize> for Pointer32<T>[src]

type Output = Pointer32<T>

The resulting type after applying the - operator.

impl<T: ?Sized> UpperHex for Pointer32<T>[src]

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for Pointer32<T>

impl<T: ?Sized> Send for Pointer32<T>

impl<T: ?Sized> Sync for Pointer32<T>

impl<T: ?Sized> Unpin for Pointer32<T>

impl<T: ?Sized> UnwindSafe for Pointer32<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.