11#![ allow( clippy:: doc_markdown) ]
22#![ doc = include_str ! ( concat!( "../" , std:: env!( "CARGO_PKG_README" ) ) ) ]
33use unsynn:: {
4- BraceGroupContaining , BracketGroupContaining , CommaDelimitedVec , Cons , Either , Error , Except ,
5- Gt , Ident , LiteralString , Lt , Many , Optional , ParenthesisGroupContaining , Parse as _, PathSep ,
6- PathSepDelimited , Pound , ToTokens as _, TokenIter , TokenStream , TokenTree , Transaction ,
7- format_ident, quote, unsynn,
4+ BraceGroupContaining , BracketGroupContaining , CommaDelimitedVec , Cons , Either , Except , Gt ,
5+ Ident , LiteralString , Lt , Many , Optional , ParenthesisGroupContaining , Parse as _, PathSep ,
6+ PathSepDelimited , Pound , ToTokens as _, TokenStream , TokenTree , format_ident, quote, unsynn,
87} ;
98
109/// Represents a module path, consisting of an optional path separator followed by
@@ -122,12 +121,15 @@ pub fn derive_as_to_variant(input: proc_macro::TokenStream) -> proc_macro::Token
122121 let to_method = format_ident ! ( "to_{variant_name_snake}" ) ;
123122 let as_method = format_ident ! ( "as_{variant_name_snake}" ) ;
124123 let inner_type = variant. value . body . content . into_token_stream ( ) ;
125- // #[doc = #msg] feature is not supported yet
126- // let _doc_to = format!("Convert to the inner {variant_name_snake} definition.");
127- // let _doc_as = format!("Reference to the inner {variant_name_snake} definition.");
124+ let doc_to = LiteralString :: from_str ( format ! (
125+ "Convert to the inner {variant_name_snake} definition."
126+ ) ) ;
127+ let doc_as = LiteralString :: from_str ( format ! (
128+ "Reference to the inner {variant_name_snake} definition."
129+ ) ) ;
128130
129131 quote ! {
130- /// Convert to the inner definition.
132+ # [ doc = #doc_to ]
131133 #[ must_use]
132134 pub fn #to_method( self ) -> Option <#inner_type> {
133135 match self {
@@ -136,7 +138,7 @@ pub fn derive_as_to_variant(input: proc_macro::TokenStream) -> proc_macro::Token
136138 }
137139 }
138140
139- /// Reference to the inner definition.
141+ # [ doc = #doc_as ]
140142 #[ must_use]
141143 pub fn #as_method( & self ) -> Option <& #inner_type> {
142144 match self {
0 commit comments