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:
4f282d4
)
Support Unit struct types
author
Matt Corallo
<git@bluematt.me>
Sat, 22 Jul 2023 17:38:46 +0000
(17:38 +0000)
committer
Matt Corallo
<git@bluematt.me>
Fri, 28 Jul 2023 23:06:00 +0000
(23:06 +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 28cce19e9715067a150a194f496b7e27eb03e640..2cd466452d00f104abb1c248c7f270377b768952 100644
(file)
--- a/
c-bindings-gen/src/main.rs
+++ b/
c-bindings-gen/src/main.rs
@@
-805,7
+805,7
@@
fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct,
define_field!(('a' as u8 + idx as u8) as char, ('0' as u8 + idx as u8) as char, field);
}
}
define_field!(('a' as u8 + idx as u8) as char, ('0' as u8 + idx as u8) as char, field);
}
}
- _ => unimplemented!()
+ syn::Fields::Unit => {},
}
if all_fields_settable {
}
if all_fields_settable {
@@
-828,7
+828,7
@@
fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct,
types.write_c_type(w, &field.ty, Some(&gen_types), false);
}
}
types.write_c_type(w, &field.ty, Some(&gen_types), false);
}
}
- _ => unreachable!()
+ syn::Fields::Unit => {},
}
write!(w, ") -> {} {{\n\t", struct_name).unwrap();
match &s.fields {
}
write!(w, ") -> {} {{\n\t", struct_name).unwrap();
match &s.fields {
@@
-848,7
+848,7
@@
fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct,
}
}
},
}
}
},
- _ => unreachable!()
+ syn::Fields::Unit => {},
}
write!(w, "{} {{ inner: ObjOps::heap_alloc(", struct_name).unwrap();
match &s.fields {
}
write!(w, "{} {{ inner: ObjOps::heap_alloc(", struct_name).unwrap();
match &s.fields {
@@
-876,7
+876,7
@@
fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct,
}
write!(w, "\t)").unwrap();
},
}
write!(w, "\t)").unwrap();
},
- _ => unreachable!()
+ syn::Fields::Unit => write!(w, "{}::{} {{}}", types.module_path, struct_name).unwrap(),
}
writeln!(w, "), is_owned: true }}\n}}").unwrap();
}
}
writeln!(w, "), is_owned: true }}\n}}").unwrap();
}