PointerExt

Trait PointerExt 

Source
pub trait PointerExt<T: ?Sized>: Sized {
    // Required methods
    fn addr_logic(self) -> usize;
    fn is_aligned_logic(self) -> bool;

    // Provided methods
    fn is_null_logic(self) -> bool { ... }
    fn is_aligned_to_logic(self, align: usize) -> bool { ... }
}

Required Methods§

Source

fn addr_logic(self) -> usize

logical address of the pointer

Source

fn is_aligned_logic(self) -> bool

Logic counterpart to <*const T>::is_aligned

This is defined as is_aligned_logic (plus a noop coercion for *mut T).

Provided Methods§

Source

fn is_null_logic(self) -> bool

true if the pointer is null.

(open, sealed)

self.addr_logic() == 0usize

Source

fn is_aligned_to_logic(self, align: usize) -> bool

Logic counterpart to <*const T>::is_aligned_to

(open, sealed)

pearlite! { self.addr_logic() & (align - 1usize) == 0usize }

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: ?Sized> PointerExt<T> for *const T

Source§

fn addr_logic(self) -> usize

Source§

fn is_aligned_logic(self) -> bool

(open, inline)

is_aligned_logic(self)

Source§

impl<T: ?Sized> PointerExt<T> for *mut T

Source§

fn addr_logic(self) -> usize

Source§

fn is_aligned_logic(self) -> bool

(open, inline)

is_aligned_logic(self)

Implementors§