8 releases (5 breaking)
new 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 |
#1471 in Procedural macros
6,270 downloads per month
Used in 76 crates
(via nu-protocol)
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
~275–720KB
~16K SLoC