Crate addr_align

source ·
Expand description

This crate provides extension traits that can be used for checking alignment of values.

The trait Align is generic, and provides methods, that accept an alignment argument. For the common alignment to a 4k boundary, the specialized trait Align4k is provided.

§Examples

use addr_align::Align;
use addr_align::Align4k;
assert_eq!(0xaabbaa.align_down(4096), 0xaab000);
assert_eq!(0xaabbaa.align4k_down(), 0xaab000);

Traits§