Struct pelite::pe32::Ptr [−][src]
Typed virtual address.
Methods
impl<T: ?Sized> Ptr<T>
[src]
impl<T: ?Sized> Ptr<T>
pub fn null() -> Ptr<T>
[src]
pub fn null() -> Ptr<T>
Creates a null pointer.
pub fn is_null(self) -> bool
[src]
pub fn is_null(self) -> bool
Returns true if the pointer is null.
pub fn cast<U: ?Sized>(self) -> Ptr<U>
[src]
pub fn cast<U: ?Sized>(self) -> Ptr<U>
Casts the pointer to a different type keeping the pointer address fixed.
pub fn shift<U: ?Sized>(self, offset: Va) -> Ptr<U>
[src]
pub fn shift<U: ?Sized>(self, offset: Va) -> Ptr<U>
Offset and cast the pointer.
Access nearby values (such as data members) by offsetting and casting 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: Ptr<f32> = p.shift(4); assert_eq!(target, Ptr::from(0x2004));
pub fn fmt(self) -> [u8; 10]
[src]
pub fn fmt(self) -> [u8; 10]
Simply formats the pointer.
Examples
use std::str; use pelite::pe32::Ptr; let p: Ptr<i32> = Ptr::from(0x1f00); let fmts = p.fmt(); // Guaranteed to be safe let s = unsafe { str::from_utf8_unchecked(&fmts) }; assert_eq!(s, "0x00001f00");
Trait Implementations
impl<T: ?Sized + 'static> Pod for Ptr<T>
[src]
impl<T: ?Sized + 'static> Pod for Ptr<T>
impl<T: ?Sized> Send for Ptr<T>
[src]
impl<T: ?Sized> Send for Ptr<T>
impl<T: ?Sized> Sync for Ptr<T>
[src]
impl<T: ?Sized> Sync for Ptr<T>
impl<T: ?Sized> Copy for Ptr<T>
[src]
impl<T: ?Sized> Copy for Ptr<T>
impl<T: ?Sized> Clone for Ptr<T>
[src]
impl<T: ?Sized> Clone for Ptr<T>
fn clone(&self) -> Ptr<T>
[src]
fn clone(&self) -> Ptr<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: ?Sized> Default for Ptr<T>
[src]
impl<T: ?Sized> Default for Ptr<T>
impl<T: ?Sized> Eq for Ptr<T>
[src]
impl<T: ?Sized> Eq for Ptr<T>
impl<T: ?Sized> PartialEq for Ptr<T>
[src]
impl<T: ?Sized> PartialEq for Ptr<T>
fn eq(&self, rhs: &Ptr<T>) -> bool
[src]
fn eq(&self, rhs: &Ptr<T>) -> bool
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]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T: ?Sized> PartialOrd for Ptr<T>
[src]
impl<T: ?Sized> PartialOrd for Ptr<T>
fn partial_cmp(&self, rhs: &Ptr<T>) -> Option<Ordering>
[src]
fn partial_cmp(&self, rhs: &Ptr<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: ?Sized> Ord for Ptr<T>
[src]
impl<T: ?Sized> Ord for Ptr<T>
fn cmp(&self, rhs: &Ptr<T>) -> Ordering
[src]
fn cmp(&self, rhs: &Ptr<T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<T: ?Sized> From<Va> for Ptr<T>
[src]
impl<T: ?Sized> From<Va> for Ptr<T>
impl<T: ?Sized> From<Ptr<T>> for Va
[src]
impl<T: ?Sized> From<Ptr<T>> for Va
impl<T: ?Sized> AsRef<Va> for Ptr<T>
[src]
impl<T: ?Sized> AsRef<Va> for Ptr<T>
impl<T: ?Sized> AsMut<Va> for Ptr<T>
[src]
impl<T: ?Sized> AsMut<Va> for Ptr<T>
impl<T: Pod> Add<SignedVa> for Ptr<T>
[src]
impl<T: Pod> Add<SignedVa> for Ptr<T>
type Output = Ptr<T>
The resulting type after applying the +
operator.
fn add(self, rhs: SignedVa) -> Ptr<T>
[src]
fn add(self, rhs: SignedVa) -> Ptr<T>
Performs the +
operation.
impl<T: Pod> Add<SignedVa> for Ptr<[T]>
[src]
impl<T: Pod> Add<SignedVa> for Ptr<[T]>
type Output = Ptr<T>
The resulting type after applying the +
operator.
fn add(self, rhs: SignedVa) -> Ptr<T>
[src]
fn add(self, rhs: SignedVa) -> Ptr<T>
Performs the +
operation.
impl<T: Pod> Sub<SignedVa> for Ptr<T>
[src]
impl<T: Pod> Sub<SignedVa> for Ptr<T>
type Output = Ptr<T>
The resulting type after applying the -
operator.
fn sub(self, rhs: SignedVa) -> Ptr<T>
[src]
fn sub(self, rhs: SignedVa) -> Ptr<T>
Performs the -
operation.
impl<T: Pod> Sub<SignedVa> for Ptr<[T]>
[src]
impl<T: Pod> Sub<SignedVa> for Ptr<[T]>
type Output = Ptr<T>
The resulting type after applying the -
operator.
fn sub(self, rhs: SignedVa) -> Ptr<T>
[src]
fn sub(self, rhs: SignedVa) -> Ptr<T>
Performs the -
operation.
impl<T: ?Sized> Debug for Ptr<T>
[src]
impl<T: ?Sized> Debug for Ptr<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: ?Sized> Display for Ptr<T>
[src]
impl<T: ?Sized> Display for Ptr<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: ?Sized> Serialize for Ptr<T>
[src]
impl<T: ?Sized> Serialize for Ptr<T>