Skip to content

Commit

Permalink
glib: Also check for subtypes in Object::has_property_with_type()
Browse files Browse the repository at this point in the history
  • Loading branch information
sdroege committed Nov 6, 2024
1 parent 41daf6c commit 84cd3fd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions glib/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3328,10 +3328,11 @@ pub unsafe trait ObjectClassExt {
}

// rustdoc-stripper-ignore-next
/// Check if the object class has a property `property_name` of the given `type_`.
/// Check if the object class has a property `property_name` of the given `type_`
/// or a subtype of it.
fn has_property_with_type(&self, property_name: &str, type_: Type) -> bool {
self.property_type(property_name)
.is_some_and(|ptype| ptype == type_)
.is_some_and(|ptype| ptype.is_a(type_))
}

// rustdoc-stripper-ignore-next
Expand Down Expand Up @@ -4274,10 +4275,11 @@ impl<T: IsA<Object> + IsInterface> Interface<T> {
}

// rustdoc-stripper-ignore-next
/// Check if the interface has a property `property_name` of the given `type_`.
/// Check if the interface has a property `property_name` of the given `type_`
/// or a subtype of it.
fn has_property_with_type(&self, property_name: &str, type_: Type) -> bool {
self.property_type(property_name)
.is_some_and(|ptype| ptype == type_)
.is_some_and(|ptype| ptype.is_a(type_))
}

// rustdoc-stripper-ignore-next
Expand Down

0 comments on commit 84cd3fd

Please sign in to comment.