A crate for mucking around with piles of bytes
Go to file
Gray Olson b472189ff8
Add NoPadding, AnyBitPattern, and CheckedBitPattern traits (#91)
* add MaybePod and NoPadding traits

* MaybePod and NoPadding derive macros

* fix doctest

* fmt

* fix bad doc link

* move new casting functions into separate modules

* fmt

* fix doctest and derive test

* remove relaxed module, add anybitpattern

* rename MaybePod to CheckedCastFromPod

* rename checked casting functions

* rework CheckedCastFromPod into CheckedBitPattern

* add anybitpattern derive, fix up other derives

* fix doctest

* fix derive trait of bits type

* export AnyBitPattern derive

* export anybitpattern from traits

* actually export derive macro for AnyBitPattern

* make bits struct pub because of type leaking rules

* allow clippy lint in derive

* add copy bound to CheckedBitPattern

* - replace Pod bounds with NoPadding+AnyBitPattern
- add try and panic versions of checked cast functions
- slightly update docs

* fix derive tests

* - adapt the allocation module cast functions as well
- as part of that, make AnyBitPattern a subtrait of Zeroable
- AnyBitPattern derive also derives Zeroable

* @JakobDegen and @zakarumych nits

* superset -> subset on CheckedBitPattern and NoPadding docs

* derive Debug on generated `Bits` structs, which can be useful for debugging failures

* don't derive debug on spirv target arch

* make it work on 1.34

* merge conflicts

* fix erroneous behavior in doctest
2022-03-29 17:01:02 -06:00
.github pod_read_unaligned and try_pod_read_unaligned (#92) 2022-03-01 18:09:49 -07:00
derive Add NoPadding, AnyBitPattern, and CheckedBitPattern traits (#91) 2022-03-29 17:01:02 -06:00
src Add NoPadding, AnyBitPattern, and CheckedBitPattern traits (#91) 2022-03-29 17:01:02 -06:00
tests Replace unsound usage of transmute_copy (#72) 2021-07-22 23:12:56 -06:00
.gitignore update gitignore for bytemuck_derive 2020-08-20 19:45:36 -06:00
Cargo.toml Add NoPadding, AnyBitPattern, and CheckedBitPattern traits (#91) 2022-03-29 17:01:02 -06:00
changelog.md changelog 2022-03-01 18:11:07 -07:00
LICENSE-APACHE Add/rename LICENSE files (#36) 2020-08-31 11:55:43 -06:00
LICENSE-MIT Add/rename LICENSE files (#36) 2020-08-31 11:55:43 -06:00
LICENSE-ZLIB Add/rename LICENSE files (#36) 2020-08-31 11:55:43 -06:00
pedantic.bat base files 2019-09-19 19:09:31 -06:00
README.md Update README.md 2021-11-15 12:25:59 -07:00
rustfmt.toml [Feature] extend TransparentWrapper conversion functions (#58) 2021-03-28 23:11:13 -06:00

License:Zlib Minimum Rust Version crates.io docs.rs

bytemuck

A crate for mucking around with piles of bytes.

Stability

The goal is to stay at 1.y.z until at least the next edition of Rust.

I consider any increase of the Minimum Rust Version to be a semver breaking change, so rustc-1.34 will continue to be supported for at least the rest of the bytemuck-1.y.z series of the crate.

(The secret goal is to get all of this functionality into the standard library some day so that we don't even need to import a crate to do all this fun stuff.)