Extract doc-comment on plugin functions.

This commit is contained in:
Stephen Chung
2021-12-21 16:14:07 +08:00
parent f74486f904
commit b85a9b3c1c
11 changed files with 275 additions and 21 deletions

View File

@@ -282,6 +282,8 @@ pub struct ExportedFn {
mut_receiver: bool,
params: ExportedFnParams,
cfg_attrs: Vec<syn::Attribute>,
#[cfg(feature = "metadata")]
comment: String,
}
impl Parse for ExportedFn {
@@ -404,6 +406,8 @@ impl Parse for ExportedFn {
mut_receiver,
params: Default::default(),
cfg_attrs,
#[cfg(feature = "metadata")]
comment: Default::default(),
})
}
}
@@ -503,6 +507,16 @@ impl ExportedFn {
}
}
#[cfg(feature = "metadata")]
pub fn comment(&self) -> &str {
&self.comment
}
#[cfg(feature = "metadata")]
pub fn set_comment(&mut self, comment: String) {
self.comment = comment
}
pub fn set_cfg_attrs(&mut self, cfg_attrs: Vec<syn::Attribute>) {
self.cfg_attrs = cfg_attrs
}