fix(macros/c_api/header): Format doc comments in a c-like way
Formatting them with `/// [Comment]` is a rust convention, c uses `/** [Comment] */`.
This commit is contained in:
parent
cd5b0c9ee4
commit
17fd954e46
|
@ -111,8 +111,11 @@ pub fn generate(trixy: &CommandSpec, _config: &TrixyConfig) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn attribute_to_doc_comment(attribute: &Attribute) -> String {
|
fn attribute_to_doc_comment(attribute: &Attribute) -> String {
|
||||||
let Attribute::doc(doc_comment) = attribute;
|
if let Attribute::doc(doc_comment) = attribute {
|
||||||
format!("/// {}\n", doc_comment)
|
format!("/** {}\n*/", doc_comment)
|
||||||
|
} else {
|
||||||
|
"".to_owned()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn named_type_to_c(named_type: &NamedType) -> TokenStream2 {
|
fn named_type_to_c(named_type: &NamedType) -> TokenStream2 {
|
||||||
|
|
|
@ -104,9 +104,11 @@ fn enumeration_to_header(enumeration: &Enumeration) -> String {
|
||||||
.map(doc_identifier_to_header)
|
.map(doc_identifier_to_header)
|
||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
let states = if enumeration.states.is_empty() {
|
let states = if enumeration.states.is_empty() {
|
||||||
"/// This enum does not have variants on the rust side
|
"/**
|
||||||
/// to work around c limitiation with variant-less enums
|
* This enum does not have variants on the rust side
|
||||||
/// we added a `__never` variant:
|
* to work around c limitiation with variant-less enums
|
||||||
|
* we added a `__never` variant:
|
||||||
|
*/
|
||||||
__never,"
|
__never,"
|
||||||
.to_owned()
|
.to_owned()
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in New Issue