A crate for mucking around with piles of bytes
Go to file
Luis Wirth 30a96066fa
[Feature] extend TransparentWrapper conversion functions (#58)
* update rustfmt.toml

replace `merge_imports = true` (deprecated) with `imports_granularity = "Crate"`

* run `cargo +nightly fmt`

* rewrite docs and rename `Wrapped` to `Inner`

rewriting some docs for conciseness

rename `Wrapped` to `Inner`, because it's hard to visually differentiate between
`Wrapper` and `Wrapped`

* impl missing `TransparentWrapper::wrap_{}` fns

Implement 3 new wrapping functions on `TransparentWrapper` providing new
conversions.

- `TransparentWrapper::wrap(s: Inner) -> Self`
- `TransparentWrapper::wrap_slice(s: &[Inner]) -> &[Self]`
- `TransparentWrapper::wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]`

* impl `TransparentWrapper::unwrap_{}` fns

Implement counterparts to `TransparentWrapper::wrap_{}` functions
providing reverse conversions.

- `TransparentWrapper::unwrap(self) -> Inner`
- `TransparentWrapper::unwrap_ref(&self) -> &Inner`
- `TransparentWrapper::unwrap_mut(&mut self) -> &mut Inner`
- `TransparentWrapper::unwrap_slice(s: &[Self]) -> &[Inner]`
- `TransparentWrapper::unwrap_slice_mut(s: &mut [Self]) -> &mut [Inner]`

* add `TransparentWrapper` UB test

This test is only for MIRI to check all trait functions on
`TransparentWrapper` if they cause any UB.
The output of the functions is not checked.

* small `TransparentWrapper` doc adjustments

* change fn signature on `TransparentWrapper`

Methods on `TransparentWrapper` trait are now associated functions.
They now take `Self` instead of `self` as argument)

- `TransparentWrapper::unwrap(s: Self)`
- `TransparentWrapper::unwrap_ref(s: &Self)`
- `TransparentWrapper::unwrap_mut(s: &mut Self)`
2021-03-28 23:11:13 -06:00
.github/workflows pod_collect_to_vec (#50) 2021-01-13 16:49:11 -07:00
derive (cargo-release) start next development iteration 1.0.2-alpha.0 2020-11-27 09:33:20 -07:00
src [Feature] extend TransparentWrapper conversion functions (#58) 2021-03-28 23:11:13 -06:00
tests [Feature] extend TransparentWrapper conversion functions (#58) 2021-03-28 23:11:13 -06:00
.gitignore update gitignore for bytemuck_derive 2020-08-20 19:45:36 -06:00
Cargo.toml (cargo-release) start next development iteration 1.5.2-alpha.0 2021-02-17 21:46:55 -07:00
changelog.md changelog. 2021-02-17 21:46:31 -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 readme note 2020-07-25 16:03:30 -06: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.

Extensions

There is experimental support for the Zeroable trait being derived through a proc-macro. I'm not the author of that crate, please file bugs with that crate in the other repo.

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.)