Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_format
  5. PointerInt

PointerInt

Trait PointerInt 

Source
pub trait PointerInt:
    Copy
    + Into<u64>
    + TryFrom<u64>
    + TryFrom<usize> {
    // Required method
    fn ptr_from_u64(v: u64) -> u64;

    // Provided method
    fn ptr_from_usize(v: usize) -> Result<u64, FormatValueError> { ... }
}
Expand description

Trait implemented by target platform pointer-sized unsigned integer types (e.g., u32 on ILP32, u64 on LP64/LLP64).

Required Methods§

Source

fn ptr_from_u64(v: u64) -> u64

Converts a 64-bit unsigned integer into the target platform’s pointer width.

Provided Methods§

Source

fn ptr_from_usize(v: usize) -> Result<u64, FormatValueError>

Converts a host usize pointer address to a u64 target pointer value, returning an error if the address exceeds the target platform’s pointer range.

§Errors

Returns FormatValueError::ValueOutOfRange if v exceeds the target platform’s pointer width.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl PointerInt for u32

Source§

impl PointerInt for u64

Implementors§