#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

#2072 in Data structures

Download history 124/week @ 2024-01-02 148/week @ 2024-01-09 102/week @ 2024-01-16 107/week @ 2024-01-23 98/week @ 2024-01-30 25/week @ 2024-02-06 82/week @ 2024-02-13 126/week @ 2024-02-20 177/week @ 2024-02-27 149/week @ 2024-03-05 113/week @ 2024-03-12 117/week @ 2024-03-19 145/week @ 2024-03-26 135/week @ 2024-04-02 140/week @ 2024-04-09 130/week @ 2024-04-16

579 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