[−][src]Struct memflow::types::pointer32::Pointer32
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]
self,
mem: &mut U,
out: &mut T
) -> PartialResult<()>
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]
Trait Implementations
impl<T> Add<usize> for Pointer32<T>
[src]
type Output = Pointer32<T>
The resulting type after applying the +
operator.
fn add(self, other: usize) -> Pointer32<T>
[src]
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]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: ?Sized> LowerHex for Pointer32<T>
[src]
impl<T: ?Sized> Ord for Pointer32<T>
[src]
fn cmp(&self, rhs: &Pointer32<T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: ?Sized> PartialEq<Pointer32<T>> for Pointer32<T>
[src]
impl<T: ?Sized> PartialOrd<Pointer32<T>> for Pointer32<T>
[src]
fn partial_cmp(&self, rhs: &Pointer32<T>) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: ?Sized + 'static> Pod for Pointer32<T>
[src]
fn zeroed() -> Self
[src]
fn as_bytes(&self) -> &[u8]ⓘ
[src]
fn as_bytes_mut(&mut self) -> &mut [u8]ⓘ
[src]
fn as_data_view(&self) -> &DataView
[src]
fn as_data_view_mut(&mut self) -> &mut DataView
[src]
impl<T: ?Sized> Serialize for Pointer32<T>
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<T> Sub<usize> for Pointer32<T>
[src]
type Output = Pointer32<T>
The resulting type after applying the -
operator.
fn sub(self, other: usize) -> Pointer32<T>
[src]
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]
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,
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.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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>,