Do not remove doc-comments on pluging functions.

This commit is contained in:
Stephen Chung
2022-01-20 09:06:09 +08:00
parent f92894e337
commit 6b06019265
5 changed files with 63 additions and 37 deletions

View File

@@ -10,7 +10,13 @@ use crate::function::{
};
use crate::module::Module;
pub type ExportedConst = (String, Box<syn::Type>, syn::Expr, Vec<syn::Attribute>);
#[derive(Debug)]
pub struct ExportedConst {
pub name: String,
pub typ: Box<syn::Type>,
pub expr: syn::Expr,
pub cfg_attrs: Vec<syn::Attribute>,
}
pub fn generate_body(
fns: &mut [ExportedFn],
@@ -25,7 +31,12 @@ pub fn generate_body(
let str_type_path = syn::parse2::<syn::Path>(quote! { str }).unwrap();
let string_type_path = syn::parse2::<syn::Path>(quote! { String }).unwrap();
for (const_name, _, _, cfg_attrs) in consts {
for ExportedConst {
name: const_name,
cfg_attrs,
..
} in consts
{
let const_literal = syn::LitStr::new(&const_name, Span::call_site());
let const_ref = syn::Ident::new(&const_name, Span::call_site());