linux/rust
Alexandre Courbot ea60cea07d rust: add Alignment type
Alignment operations are very common in the kernel. Since they are
always performed using a power-of-two value, enforcing this invariant
through a dedicated type leads to fewer bugs and can improve the
generated code.

Introduce the `Alignment` type, inspired by the nightly Rust type of the
same name and providing the same interface, and a new `Alignable` trait
allowing unsigned integers to be aligned up or down.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
[ Used `build_assert!`, added intra-doc link, `allow`ed
  `clippy::incompatible_msrv`, added `feature(const_option)`, capitalized
  safety comment. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-09-22 23:55:41 +02:00
..
bindings rust: derive Zeroable for all structs & unions generated by bindgen where possible 2025-09-08 14:03:17 +02:00
helpers Rust changes for v6.17 2025-08-03 13:49:10 -07:00
kernel rust: add Alignment type 2025-09-22 23:55:41 +02:00
macros rust: macros: reduce collections in quote! macro 2025-09-22 20:57:02 +02:00
pin-init pin-init changes for v6.17 2025-07-13 23:05:14 +02:00
uapi rust: derive Zeroable for all structs & unions generated by bindgen where possible 2025-09-08 14:03:17 +02:00
.gitignore
.kunitconfig rust: add kunitconfig 2025-03-19 23:22:21 +01:00
bindgen_parameters rust: derive Zeroable for all structs & unions generated by bindgen where possible 2025-09-08 14:03:17 +02:00
build_error.rs
compiler_builtins.rs ARM: 9441/1: rust: Enable Rust support for ARMv7 2025-03-26 13:31:16 +00:00
exports.c rust: exports: improve grammar in commentary 2024-10-21 17:35:33 +02:00
ffi.rs rust: use absolute paths in macros referencing core and kernel 2025-05-23 00:12:14 +02:00
Makefile rust: add pin-init as a dependency to bindings and uapi 2025-09-08 13:42:39 +02:00