From 84cd3fd35f5675f4aa882b47c237a24923122cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 6 Nov 2024 10:19:15 +0200 Subject: [PATCH] glib: Also check for subtypes in `Object::has_property_with_type()` --- glib/src/object.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/glib/src/object.rs b/glib/src/object.rs index 998a7a1e1448..ca48a210d72b 100644 --- a/glib/src/object.rs +++ b/glib/src/object.rs @@ -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 @@ -4274,10 +4275,11 @@ impl + IsInterface> Interface { } // 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