Skip to content

Commit 9b5119e

Browse files
authored
Merge pull request #24 from ModProg/publish-parse-macro
publish impl_Attribute_for_Parse_and_ToTokens!
2 parents 5c19727 + fc3a492 commit 9b5119e

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
- published `impl_Attribute_for_Parse_and_ToTokens!` to "derive" `AttributeValue` traits via existing `Parse` and `ToTokens` implementation.
810

911
## [0.10.1] - 2024-08-27
1012
### Fixed

Diff for: src/syn_impls.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ use crate::*;
2323

2424
/// Macro to easily implement [`AttributeValue`] for types implementing
2525
/// [`Parse`] and [`ToTokens`].
26-
macro_rules! ParseToTokensAttribute {
26+
#[macro_export]
27+
macro_rules! impl_Attribute_for_Parse_and_ToTokens {
2728
($($type:ty),+ $(,)?) => {$(
2829
impl AttributeBase for $type {
2930
type Partial = Self;
@@ -100,12 +101,12 @@ impl AttributeMeta for TokenStream {
100101
// };
101102
// }
102103

103-
ParseToTokensAttribute!(Type);
104-
ParseToTokensAttribute!(Path);
105-
ParseToTokensAttribute!(Lit);
106-
ParseToTokensAttribute![LitStr, LitByteStr, LitChar, LitInt, LitFloat, LitBool];
107-
ParseToTokensAttribute!(Expr);
108-
ParseToTokensAttribute![TokenTree, Group, Punct, Literal];
104+
impl_Attribute_for_Parse_and_ToTokens!(Type);
105+
impl_Attribute_for_Parse_and_ToTokens!(Path);
106+
impl_Attribute_for_Parse_and_ToTokens!(Lit);
107+
impl_Attribute_for_Parse_and_ToTokens![LitStr, LitByteStr, LitChar, LitInt, LitFloat, LitBool];
108+
impl_Attribute_for_Parse_and_ToTokens!(Expr);
109+
impl_Attribute_for_Parse_and_ToTokens![TokenTree, Group, Punct, Literal];
109110

110111
// // TODO make this warning better visable
111112
// ParseToTokensAttribute! {
@@ -118,7 +119,7 @@ ParseToTokensAttribute![TokenTree, Group, Punct, Literal];
118119
// }
119120

120121
// Some probably useless stuff
121-
ParseToTokensAttribute![
122+
impl_Attribute_for_Parse_and_ToTokens![
122123
Abi,
123124
Abstract,
124125
Plus,
@@ -283,7 +284,7 @@ mod syn_full {
283284

284285
use super::*;
285286

286-
ParseToTokensAttribute![
287+
impl_Attribute_for_Parse_and_ToTokens![
287288
Arm,
288289
Block,
289290
ExprArray,

0 commit comments

Comments
 (0)