Skip to content

Commit c7aa72a

Browse files
parser: Don't require name/type for record types
As gtk4 now has a record that contains a union without a name/c-type
1 parent 670d50c commit c7aa72a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,15 @@ impl Library {
292292
parent_name_prefix: Option<&str>,
293293
parent_ctype_prefix: Option<&str>,
294294
) -> Result<Option<Type>, String> {
295-
let record_name = elem.attr_required("name")?;
295+
let record_name = elem.attr("name").unwrap_or_default();
296296
// Records starting with `_` are intended to be private and should not be bound
297297
if record_name.starts_with('_') {
298298
parser.ignore_element()?;
299299
return Ok(None);
300300
}
301301
let is_class_record = record_name.ends_with("Class");
302302

303-
let c_type = elem.attr_required("type")?;
303+
let c_type = elem.attr("type").unwrap_or_default();
304304
let symbol_prefix = elem.attr("symbol-prefix").map(ToOwned::to_owned);
305305
let get_type = elem.attr("get-type").map(ToOwned::to_owned);
306306
let gtype_struct_for = elem.attr("is-gtype-struct-for");

0 commit comments

Comments
 (0)