Commit Graph

373 Commits

Author SHA1 Message Date
Lokathor
950ae43012 back to the correct derive dependency line 2022-03-29 23:13:34 -06:00
Lokathor
d8215fb95a
Update changelog.md (#96)
* Update changelog.md

* Update changelog.md

* Use the `5` instead of an `s`, because we're l33t
2022-03-29 23:10:43 -06:00
Gray Olson
1fb245c926
rename NoPadding to NoUninit and clarify docs (#95) 2022-03-29 21:25:51 -06:00
Gray Olson
1652a2dcd2
Support unions in derive macros (#94)
* allow deriving traits on unions in some cases

* basic union tests for nopadding and anybitpattern

* implement derives for unions for more traits

* remove Pod and AnyBitPattern derives for unions due to possible unsoundness
2022-03-29 20:01:48 -06:00
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
Lokathor
4569a30c9f (cargo-release) version 1.8.0 2022-03-01 18:12:36 -07:00
Lokathor
bd6bb87225 changelog 2022-03-01 18:11:07 -07:00
Lokathor
7fa51a420d
pod_read_unaligned and try_pod_read_unaligned (#92)
* pod_read_unaligned and try_pod_read_unaligned

* only do all-features on nightly.

* I forgot we can't use .cast on 1.34
2022-03-01 18:09:49 -07:00
Christopher Serr
6029639753
Implement Pod and Zeroable for AArch64 NEON Vectors (#80)
* Implement `Pod` and `Zeroable` for AArch64 NEON Vectors

The NEON intrinsics will be stabilized in Rust 1.59.

* Compile all-features only on nightly
2021-12-21 19:01:47 -07:00
Lokathor
e32f013a06 (cargo-release) version 1.7.3 2021-12-15 23:20:30 -07:00
Lokathor
87e78fefd7 update changelog. 2021-12-15 23:19:43 -07:00
Lokathor
c8ffbd19dd Merge branch 'main' of https://github.com/Lokathor/bytemuck into main 2021-12-15 23:16:42 -07:00
Lokathor
dd01ccae42 nightly_portable_simd 2021-12-15 23:16:38 -07:00
Alphyr
3923766b67
Impls for PhantomPinned and more PhantomData (#79) 2021-12-08 18:59:22 -07:00
Lokathor
a64046f3b8 Create FUNDING.yml 2021-12-08 00:38:14 -07:00
Lokathor
f9edfed1d5
Update README.md
Closes https://github.com/Lokathor/bytemuck/issues/77
2021-11-15 12:25:59 -07:00
Christopher Serr
944c90ca3f
Support WASM SIMD's v128 type (#73)
Due to the MSRV it is behind a feature gate.
2021-10-15 13:46:52 -06:00
Gauthier Segay
9ea604addb
minor doc patch to help users adjust their Cargo.toml for usage of the allocation module. (#76)
* just pointer to how to set the crate feature

helps the Cargo newbies to enable the feature easily while reading the documentation.

* Update allocation.rs
2021-10-15 13:45:16 -06:00
Lokathor
e01c6b3a2d (cargo-release) start next development iteration 1.7.3-alpha.0 2021-07-22 23:30:18 -06:00
Lokathor
be16fe2958 (cargo-release) version 1.7.2 2021-07-22 23:29:59 -06:00
Lokathor
77b8b39e40 changelog. 2021-07-22 23:29:45 -06:00
Lokathor
d8b26f4eef Merge branch 'main' of https://github.com/Lokathor/bytemuck into main 2021-07-22 23:27:12 -06:00
Lokathor
8ea087185e (cargo-release) start next development iteration 1.7.2-alpha.0 2021-07-22 23:26:51 -06:00
Lokathor
5024fcc6fb (cargo-release) version 1.7.1 2021-07-22 23:26:26 -06:00
Lokathor
c83a9f6c68 changelog. 2021-07-22 23:26:16 -06:00
Christopher Durham
1a4c11a675
Replace unsound usage of transmute_copy (#72)
* Use transmute! to enforce safer transmute_copy use

* Test fix for #71
2021-07-22 23:12:56 -06:00
Lokathor
6db9c1944b (cargo-release) start next development iteration 1.7.1-alpha.0 2021-06-13 08:42:13 -06:00
Lokathor
19c41fb116 (cargo-release) version 1.7.0 2021-06-13 08:41:56 -06:00
Lokathor
05d956f3b4
ptr pod impl fix. (#65)
* gate the unsound impl.

* changelog

* update cargo.toml
2021-06-13 08:40:58 -06:00
Lokathor
84397ec62f (cargo-release) start next development iteration 1.6.4-alpha.0 2021-06-13 08:17:30 -06:00
Lokathor
fa43870786 (cargo-release) version 1.6.3 2021-06-13 08:17:13 -06:00
Lokathor
71ca75abd3 changelog. 2021-06-13 08:17:00 -06:00
Lokathor
7f8b15e6e9 Merge branch 'main' of https://github.com/Lokathor/bytemuck into main 2021-06-13 08:15:28 -06:00
Lokathor
fd901461ad (cargo-release) start next development iteration 1.6.3-alpha.0 2021-06-13 08:14:37 -06:00
Lokathor
987baf6273 (cargo-release) version 1.6.2 2021-06-13 08:14:12 -06:00
Lokathor
ef690ba86d changelog. 2021-06-13 08:14:04 -06:00
Daniel McNab
291b2d2513
Just gate the Display impl instead (#69)
The old version didn't compile (because of the extra semicolon)
2021-06-13 08:12:24 -06:00
Lokathor
8c8b0a71e9 (cargo-release) start next development iteration 1.6.2-alpha.0 2021-06-11 19:16:30 -06:00
Lokathor
223ee7deaf (cargo-release) version 1.6.1 2021-06-11 19:16:08 -06:00
Lokathor
222db6639f changelog. 2021-06-11 19:15:59 -06:00
Daniel McNab
043c18b4ba
Allow building on spir-v (#67)
* Allow building on spir-v

* Remove spurious `self`
2021-06-11 13:30:50 -06:00
Lokathor
c33343ddfb (cargo-release) start next development iteration 1.6.1-alpha.0 2021-06-10 14:10:58 -06:00
Lokathor
37b82b32c6 (cargo-release) version 1.6.0 2021-06-10 14:10:35 -06:00
Lokathor
65121b48eb changelog. 2021-06-10 14:09:58 -06:00
Lokathor
99ecb1f6cb rename "unwrap" to "peel". 2021-06-10 14:05:15 -06:00
Connor Horman
cd8dbd64e9
Attach min_const_generics to a crate feature (#63)
* Attach min_const_generics to a crate feature

* Remove `min_const_generics` detection logic
2021-06-05 08:25:57 -06:00
Zakarum
f3e16c7051
Implement Pod and Zeroable for arrays of any size (#59)
* Implement Pod and Zeroable for arrays of any size

Only when rustc version is 1.51 or newer

* Rename cfg flag after feature name
2021-04-01 19:56:49 -06:00
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
Lokathor
08a4b8fbc2 (cargo-release) start next development iteration 1.5.2-alpha.0 2021-02-17 21:46:55 -07:00
Lokathor
6f1c78e824 (cargo-release) version 1.5.1 2021-02-17 21:46:34 -07:00