Skip to content

Commit

Permalink
parser: Don't require name/type for record types
Browse files Browse the repository at this point in the history
As gtk4 now has a record that contains a union without a name/c-type
  • Loading branch information
bilelmoussaoui committed Sep 23, 2023
1 parent 670d50c commit c7aa72a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,15 @@ impl Library {
parent_name_prefix: Option<&str>,
parent_ctype_prefix: Option<&str>,
) -> Result<Option<Type>, String> {
let record_name = elem.attr_required("name")?;
let record_name = elem.attr("name").unwrap_or_default();
// Records starting with `_` are intended to be private and should not be bound
if record_name.starts_with('_') {
parser.ignore_element()?;
return Ok(None);
}
let is_class_record = record_name.ends_with("Class");

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

0 comments on commit c7aa72a

Please sign in to comment.