@@ -169,6 +169,8 @@ struct MethodInfo {
169
169
output : ReturnType ,
170
170
/// The cfg attributes of the method.
171
171
cfg_attrs : Vec < Attribute > ,
172
+ /// The doc attributes of the method.
173
+ doc_attrs : Vec < Attribute > ,
172
174
}
173
175
174
176
impl MethodInfo {
@@ -177,6 +179,7 @@ impl MethodInfo {
177
179
method : & ImplItemFn ,
178
180
attrs : & MethodAttrs ,
179
181
cfg_attrs : & [ & Attribute ] ,
182
+ doc_attrs : & [ & Attribute ] ,
180
183
) -> syn:: Result < MethodInfo > {
181
184
let is_async = method. sig . asyncness . is_some ( ) ;
182
185
let Signature {
@@ -319,6 +322,7 @@ impl MethodInfo {
319
322
proxy_attrs,
320
323
output : output. clone ( ) ,
321
324
cfg_attrs : cfg_attrs. iter ( ) . cloned ( ) . cloned ( ) . collect ( ) ,
325
+ doc_attrs : doc_attrs. iter ( ) . cloned ( ) . cloned ( ) . collect ( ) ,
322
326
} )
323
327
}
324
328
}
@@ -420,8 +424,13 @@ pub fn expand<T: AttrParse + Into<ImplAttrs>, M: AttrParse + Into<MethodAttrs>>(
420
424
. iter ( )
421
425
. filter ( |a| a. path ( ) . is_ident ( "cfg" ) )
422
426
. collect ( ) ;
427
+ let doc_attrs: Vec < _ > = method
428
+ . attrs
429
+ . iter ( )
430
+ . filter ( |a| a. path ( ) . is_ident ( "doc" ) )
431
+ . collect ( ) ;
423
432
424
- let method_info = MethodInfo :: new ( & zbus, method, & attrs, & cfg_attrs) ?;
433
+ let method_info = MethodInfo :: new ( & zbus, method, & attrs, & cfg_attrs, & doc_attrs ) ?;
425
434
let attr_property = match attrs {
426
435
MethodAttrs :: Old ( o) => o. property . map ( |op| PropertyAttributes {
427
436
emits_changed_signal : op. emits_changed_signal ,
@@ -1384,8 +1393,10 @@ impl Proxy {
1384
1393
}
1385
1394
let cfg_attrs = method_info. cfg_attrs ;
1386
1395
let zbus = & self . zbus ;
1396
+ let doc_attrs = method_info. doc_attrs ;
1387
1397
self . methods . extend ( quote ! {
1388
1398
#( #cfg_attrs) *
1399
+ #( #doc_attrs) *
1389
1400
#[ zbus( #proxy_method_attrs) ]
1390
1401
fn #ident( & self , #inputs) -> #zbus:: Result <#ret>;
1391
1402
} ) ;
0 commit comments