#enums #general #i32 #macro #converting #nvml-wrapper

macro wrapcenum-derive

Derive macro for nvml-wrapper, not for general use

5 releases (3 breaking)

0.4.1 Feb 10, 2024
0.4.0 Jun 16, 2020
0.3.0 Jul 20, 2017
0.2.0 Jun 8, 2017
0.1.0 May 17, 2017

#712 in Procedural macros

Download history 5397/week @ 2023-12-06 4821/week @ 2023-12-13 4188/week @ 2023-12-20 2910/week @ 2023-12-27 5468/week @ 2024-01-03 4653/week @ 2024-01-10 5371/week @ 2024-01-17 6527/week @ 2024-01-24 5738/week @ 2024-01-31 5228/week @ 2024-02-07 5415/week @ 2024-02-14 5805/week @ 2024-02-21 5957/week @ 2024-02-28 5691/week @ 2024-03-06 5993/week @ 2024-03-13 5442/week @ 2024-03-20

24,171 downloads per month
Used in 21 crates (via nvml-wrapper)

MIT/Apache

8KB
79 lines

wrapcenum-derive

Internal macro used in nvml-wrapper.

This macro is tied to the crate and is not meant for use by the general public.

Its purpose is to auto-generate both a TryFrom implementation converting an i32 into a Rust enum (specifically for converting a C enum represented as an integer that has come over FFI) and an as_c method for converting the Rust enum back into an i32.

It wouldn't take much effort to turn this into something usable by others; if you're interested feel free to contribute or file an issue asking me to put some work into it.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.7–1.1MB
~25K SLoC