Commit Graph

83 Commits

Author SHA1 Message Date
Daniel Henry-Mantilla
1ebf7c251d
Cleanup: use a macro for reprs, use syn errors & fix cfg-target-arch (#124) 2022-08-12 06:50:51 -06:00
Tom Dohrmann
2c97676bfc
support deriving Pod for packed generic types. (#123)
* improve `#[repr]` parsing

* allow deriving `Pod` for packed generic types

* Revert "Update Cargo.toml"

This reverts commit 6632bcef2c.
2022-08-07 14:32:00 -06:00
Lokathor
a053f1d887 derive version bump. 2022-07-18 19:27:55 -06:00
Edward
2864b52591
Fix/syn broken semver (#116)
* fix(derive): syn backwards compatibility

* fix: bump minimum syn version more after tests
2022-07-18 19:25:00 -06:00
piwicode
9d90497f7c
Replace LICENCES-* symlinks with a licence copy. (#118)
Fixes the licences content in bytemuck_derive.

Archives on crates.io does not contain a licence copy, but
just a file containing the symlink relative path instead.

https://static.crates.io/crates/bytemuck_derive/bytemuck_derive-1.1.0.crate
2022-07-13 06:53:17 -06:00
daxpedda
237d7d3730
Avoid clippy::missing_const_for_fn (#115) 2022-07-08 17:16:25 -06:00
Nicholas Bishop
96f2e549b3
Fix docstring typo (#104) 2022-05-13 14:51:43 -06:00
Lokathor
73ae1ee89e (cargo-release) version 1.1.0 2022-03-29 23:15:56 -06:00
Lokathor
4459b9295c changelog for the derives. 2022-03-29 23:15:32 -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
df53958735 (cargo-release) start next development iteration 1.0.2-alpha.0 2020-11-27 09:33:20 -07:00
Lokathor
1cf639571b (cargo-release) version 1.0.1 2020-11-27 09:32:36 -07:00
Fabio Valentini
51d68a4220
Include LICENSE files in published bytemuck_derive crates (#47) 2020-11-27 08:31:40 -07:00
Lokathor
094f76ad73
Closes https://github.com/Lokathor/bytemuck/issues/39
On older compilers, you need to say `extern crate proc_macro;` even in 2018 edition. Since it doesn't hurt in newer compilers, we'll just do that.
2020-10-21 14:21:43 -06:00
Lokathor
00cbef6b83
Create changelog.md 2020-10-21 14:19:13 -06:00
Yanchi Toth
b264926ac0
Emit padding-asserting code that doesn't trigger clippy::identity_op (#45) 2020-10-21 14:11:30 -06:00
Lokathor
c171ac4f5b (cargo-release) start next development iteration 1.0.1-alpha.0 2020-08-27 21:34:05 -06:00
Lokathor
9aedc156a8 (cargo-release) version 1.0.0 2020-08-27 21:33:46 -06:00
Lokathor
a6418a963d clarify versions. 2020-08-27 21:27:48 -06:00
Lucien Greathouse
19e61623d7
Blame struct name, better error for padding (#35) 2020-08-23 20:12:47 -06:00
Lokathor
e053f8b456 Merge branch 'main' of https://github.com/Lokathor/bytemuck into main 2020-08-22 06:48:30 -06:00
Robin Appelman
24b71e078f
add derive macro for Contiguous (#31) 2020-08-21 16:08:34 -06:00
Lokathor
e202fa2756 (cargo-release) version 1.0.0-alpha.3 2020-08-21 15:27:04 -06:00
Lucien Greathouse
550dc3396c
Fix Pod derive to use explicit absolute path to 'core' (#32) 2020-08-21 15:13:55 -06:00
Lokathor
ef32c088a2 docs typo 2020-08-20 20:28:54 -06:00
Lokathor
14fa8650f0 (cargo-release) version 1.0.0-alpha.2 2020-08-20 19:46:44 -06:00
Lokathor
d88235518f bytemuck_derive: readme 2020-08-20 19:46:22 -06:00
Lokathor
044c1c3057 (cargo-release) version 1.0.0-alpha.1 2020-08-20 19:41:51 -06:00
Lokathor
87e48ba1d9 ready bytemuck_derive for an alpha publish. 2020-08-20 19:37:56 -06:00
Lokathor
a64f697cd5 give the derives crate a better description. 2020-08-20 19:05:59 -06:00
Robin Appelman
cf944452b7
add basic derive macro for Pod, Zeroable and TransparentWrapper for structs (#30)
* add basic derive macro for Pod and Zeroable for structs

* add derive macro for TransparentWrapper

* use core::mem::size_of instead of std::mem::size_of in generated code

* cleanup error handling a bit

* remove unneeded iter logic

* remove unneeded clone and order impl

* fix generics

* fix doc typo

Co-authored-by: Lucien Greathouse <me@lpghatguy.com>

* remove unneeded lifetime anotation

* use unreachable for already rejected patch

Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
2020-08-20 19:04:36 -06:00