[][src]Struct pelite::pe64::Ptr

#[repr(transparent)]
pub struct Ptr<T: ?Sized = ()> { /* fields omitted */ }

Typed virtual address.

Methods

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

pub const NULL: Ptr<T>[src]

Null pointer constant.

pub const fn null() -> Ptr<T>[src]

Creates a null pointer.

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

Returns true if the pointer is null.

pub const fn member(va: Va, offset: u32) -> Ptr<T>[src]

Constructs a pointer with an offset.

pub const fn cast<U: ?Sized>(self) -> Ptr<U>[src]

Casts the pointer to a different type keeping the pointer address fixed.

pub const fn offset<U: ?Sized>(self, offset: i64) -> Ptr<U>[src]

Offsets and casts the pointer.

Because the type of the current and the target may be unrelated, this is a byte offset.

Examples

use pelite::pe64::Ptr;

#[repr(C)]
struct Composite {
	int: i32,
	float: f32,
}

let p: Ptr<Composite> = Ptr::from(0x2000);
let target = p.offset::<f32>(4);

assert_eq!(target, Ptr::from(0x2004));

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

Returns the raw integer, type ascription helper.

impl<T> Ptr<[T]>[src]

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

Decays the pointer from [T] to T.

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

Pointer arithmetic, gets the pointer of an element at the specified index.

Trait Implementations

impl<T: ?Sized> Pod for Ptr<T> where
    Ptr<T>: 'static, 
[src]

impl<T: ?Sized> AsRef<u64> for Ptr<T>[src]

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

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

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

impl<T: ?Sized> AsMut<u64> for Ptr<T>[src]

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

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

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

impl<T: ?Sized> From<u64> for Ptr<T>[src]

impl<T: ?Sized> From<Ptr<T>> for Va[src]

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

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

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

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

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

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

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

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[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.

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

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

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