Crates.io | slicefields |
lib.rs | slicefields |
version | 1.0.4 |
source | src |
created_at | 2023-07-12 19:58:46.434 |
updated_at | 2023-11-09 15:45:04.851694 |
description | Allows for data structures whose members are sub byte aligned (e.g. a one bit alignment) |
homepage | |
repository | https://codeberg.org/TeleportAura/bitstruct |
max_upload_size | |
id | 914763 |
size | 49,543 |
The slicefields crate provides a zero-cost way of using bit slices into fields of a struct as if they were real fields.
It is extremely flexible, works with any types (not just Rust's built-ins) implementing the necessary traits for bitwise operations and has support for volatile reads/writes as well as access to unaligned pointers on all architectures.
The goal of slicefields is to generate code which compiles down to as performant machine code
as possible, even without compiler optimizations enabled. While this certainly results in the
generated Rust code looking very weird, it should achieve its goal most of the time.
The fantastic Godbolt compiler explorer was used heavily during
the process of writing slicefields.
https://docs.rs/slicefields
Examples for all of the above mentioned features can also be found in its tests
This project is open to any sorts of contributions, be it by notifying me of an issue with the library or by directly contributing code. Since I want to keep this library small and simple, however, you should open an issue to discuss the changes you want to make before starting work on a pull request.
Copyright 2023, TeleportAura
This software is licensed under the MPL 2.0 license