aligned_utils/
lib.rs

1//! Common utilities to work with aligned values and allocation.
2//!
3//! # Example
4//!
5//! ```
6//! use aligned_utils::stack::Align8;
7//! let mut arr = Align8([1, 2, 3]);
8//! let bytes: &[u8] = &*arr;
9//! ```
10//!
11//! ```
12//! # #[cfg(feature="alloc")]
13//! # {
14//! use aligned_utils::bytes::AlignedBytes; // with feature "alloc"
15//! let mut bytes = AlignedBytes::new_zeroed(1024, 8);
16//! let buf: &mut [u8] = &mut *bytes;
17//! # }
18//! ```
19//!
20
21#![deny(
22    anonymous_parameters,
23    bare_trait_objects,
24    elided_lifetimes_in_paths,
25    missing_copy_implementations,
26    missing_debug_implementations,
27    missing_docs,
28    single_use_lifetimes,
29    trivial_casts,
30    trivial_numeric_casts,
31    unreachable_pub,
32    unstable_features,
33    unused_extern_crates,
34    unused_import_braces,
35    unused_qualifications,
36    unused_results,
37    clippy::all,
38    clippy::pedantic,
39    clippy::nursery,
40    clippy::cargo
41)]
42#![allow(box_pointers, clippy::module_name_repetitions)]
43#![no_std]
44
45#[cfg(feature = "alloc")]
46extern crate alloc;
47
48#[cfg(feature = "std")]
49extern crate std;
50
51pub mod stack;
52
53#[cfg(feature = "alloc")]
54pub mod bytes;