#alloc #align #alignment #no-std

no-std aligned-utils

Common utilities to work with aligned values and allocation

4 releases (stable)

1.0.2 Feb 27, 2021
1.0.1 Jan 28, 2021
1.0.0 Jan 12, 2021
0.2.0 Dec 31, 2020

#2201 in Data structures

Download history 150/week @ 2024-03-25 147/week @ 2024-04-01 124/week @ 2024-04-08 138/week @ 2024-04-15 142/week @ 2024-04-22 71/week @ 2024-04-29 121/week @ 2024-05-06 63/week @ 2024-05-13 44/week @ 2024-05-20 59/week @ 2024-05-27 112/week @ 2024-06-03 38/week @ 2024-06-10 14/week @ 2024-06-17 5/week @ 2024-06-24 23/week @ 2024-07-01 21/week @ 2024-07-08

66 downloads per month
Used in carapace

MIT license

14KB
308 lines

aligned-utils

Crates.io MIT licensed Docs CI

Common utilities to work with aligned values and allocation.

Example

use aligned_utils::stack::Align8;
let mut arr = Align8([1, 2, 3]);
let bytes: &[u8] = &*arr;
use aligned_utils::bytes::AlignedBytes;  // with feature "alloc"
let mut bytes = AlignedBytes::new_zeroed(1024, 8);
let buf: &mut [u8] = &mut *bytes;

lib.rs:

Common utilities to work with aligned values and allocation.

Example

use aligned_utils::stack::Align8;
let mut arr = Align8([1, 2, 3]);
let bytes: &[u8] = &*arr;
use aligned_utils::bytes::AlignedBytes; // with feature "alloc"
let mut bytes = AlignedBytes::new_zeroed(1024, 8);
let buf: &mut [u8] = &mut *bytes;

No runtime deps

Features