8 releases (5 breaking)

0.100.0 Nov 13, 2024
0.99.1 Oct 20, 2024
0.98.0 Sep 18, 2024
0.97.1 Aug 21, 2024
0.95.0 Jun 25, 2024

#1555 in Procedural macros

Download history 1282/week @ 2024-08-31 769/week @ 2024-09-07 1491/week @ 2024-09-14 1337/week @ 2024-09-21 1181/week @ 2024-09-28 942/week @ 2024-10-05 1952/week @ 2024-10-12 1841/week @ 2024-10-19 1116/week @ 2024-10-26 1389/week @ 2024-11-02 1691/week @ 2024-11-09 1170/week @ 2024-11-16 1266/week @ 2024-11-23 2031/week @ 2024-11-30 1815/week @ 2024-12-07 1643/week @ 2024-12-14

6,901 downloads per month
Used in 78 crates (via nu-protocol)

MIT license

61KB
967 lines

Macro implementations of #[derive(FromValue, IntoValue)].

As this crate is a proc_macro crate, it is only allowed to export procedural macros. Therefore, it only exports IntoValue and FromValue.

To get documentation for other functions and types used in this crate, run cargo doc -p nu-derive-value --document-private-items.

This crate uses a lot of proc_macro2::TokenStream as TokenStream2 to allow testing the behavior of the macros directly, including the output token stream or if the macro errors as expected. The tests for functionality can be found in nu_protocol::value::test_derive.

This documentation is often less reference-heavy than typical Rust documentation. This is because this crate is a dependency for nu_protocol, and linking to it would create a cyclic dependency. Also all examples in the documentation aren't tested as this crate cannot be compiled as a normal library very easily. This might change in the future if cargo allows building a proc-macro crate differently for cfg(doctest) as they are already doing for cfg(test).

The generated code from the derive macros tries to be as hygienic as possible. This ensures that the macro can be called anywhere without requiring specific imports. This results in obtuse code, which isn't recommended for manual, handwritten Rust but ensures that no other code may influence this generated code or vice versa.

Dependencies

~305–760KB
~17K SLoC