projects
/
ldk-c-bindings
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef521e1
)
Print field documentation even for unnamed enum variant fields
author
Matt Corallo
<git@bluematt.me>
Tue, 28 Jun 2022 02:17:18 +0000
(
02:17
+0000)
committer
Matt Corallo
<git@bluematt.me>
Tue, 28 Jun 2022 02:26:57 +0000
(
02:26
+0000)
c-bindings-gen/src/main.rs
patch
|
blob
|
history
diff --git
a/c-bindings-gen/src/main.rs
b/c-bindings-gen/src/main.rs
index 720ddbd8bc9f17232bed2e1750fc13a84460bcf7..aaf5a630da3e46c80a9ea06046a93e935df48594 100644
(file)
--- a/
c-bindings-gen/src/main.rs
+++ b/
c-bindings-gen/src/main.rs
@@
-1656,14
+1656,17
@@
fn writeln_enum<'a, 'b, W: std::io::Write>(w: &mut W, e: &'a syn::ItemEnum, type
}
if !empty_tuple_variant {
needs_free = true;
}
if !empty_tuple_variant {
needs_free = true;
- write!(w, "(").unwrap();
+ write
ln
!(w, "(").unwrap();
for (idx, field) in fields.unnamed.iter().enumerate() {
if export_status(&field.attrs) == ExportStatus::TestOnly { continue; }
for (idx, field) in fields.unnamed.iter().enumerate() {
if export_status(&field.attrs) == ExportStatus::TestOnly { continue; }
- write!(&mut constr, "{}: ", ('a' as u8 + idx as u8) as char).unwrap();
+ writeln_field_docs(w, &field.attrs, "\t\t", types, Some(&gen_types), &field.ty);
+ write!(w, "\t\t").unwrap();
types.write_c_type(w, &field.ty, Some(&gen_types), true);
types.write_c_type(w, &field.ty, Some(&gen_types), true);
+
+ write!(&mut constr, "{}: ", ('a' as u8 + idx as u8) as char).unwrap();
types.write_c_type(&mut constr, &field.ty, Some(&gen_types), true);
if idx != fields.unnamed.len() - 1 {
types.write_c_type(&mut constr, &field.ty, Some(&gen_types), true);
if idx != fields.unnamed.len() - 1 {
- write!(w, ",").unwrap();
+ write
ln
!(w, ",").unwrap();
write!(&mut constr, ",").unwrap();
}
}
write!(&mut constr, ",").unwrap();
}
}