os_units

Crates.io docs.rs Rust

This crate provides a data structure for byte size. With x86_64 crate, you can easily convert the size of physical memory pages into bytes, and bytes into the number of physical memory pages.

Examples

```rust use osunits::{Size, Bytes}; use x8664::structures::paging::{PageSize, Size4KiB};

let bytesofkernel = Size::::new(314159); let pagesofkernel = bytesofkernel.asnumofpages::(); asserteq!(pagesofkernel.as_usize(), 77);

let bytesofpages = pagesofkernel.asbytes(); asserteq!(bytesofpages.as_usize(), 315392); ```

License: MPL-2.0