Skip to content

Commit 07dbf34

Browse files
committed
Add IsA<Object> trait bound to Impl traits
1 parent 3c8aacc commit 07dbf34

25 files changed

+356
-77
lines changed

gdk-pixbuf/src/subclass/pixbuf_animation.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::{ffi, Pixbuf, PixbufAnimation, PixbufAnimationIter};
1515

1616
pub trait PixbufAnimationImpl: ObjectImpl
1717
where
18+
<Self as ObjectSubclass>::Type: IsA<glib::Object>,
1819
<Self as ObjectSubclass>::Type: IsA<PixbufAnimation>,
1920
{
2021
fn is_static_image(&self) -> bool {
@@ -36,6 +37,7 @@ where
3637

3738
pub trait PixbufAnimationImplExt: ObjectSubclass + PixbufAnimationImpl
3839
where
40+
<Self as ObjectSubclass>::Type: IsA<glib::Object>,
3941
<Self as ObjectSubclass>::Type: IsA<PixbufAnimation>,
4042
{
4143
fn parent_is_static_image(&self) -> bool {
@@ -117,13 +119,16 @@ where
117119
}
118120
}
119121

120-
impl<T: PixbufAnimationImpl> PixbufAnimationImplExt for T where
121-
<Self as ObjectSubclass>::Type: IsA<PixbufAnimation>
122+
impl<T: PixbufAnimationImpl> PixbufAnimationImplExt for T
123+
where
124+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
125+
<T as ObjectSubclass>::Type: IsA<PixbufAnimation>,
122126
{
123127
}
124128

125129
unsafe impl<T: PixbufAnimationImpl> IsSubclassable<T> for PixbufAnimation
126130
where
131+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
127132
<T as ObjectSubclass>::Type: IsA<PixbufAnimation>,
128133
{
129134
fn class_init(class: &mut ::glib::Class<Self>) {
@@ -141,6 +146,7 @@ unsafe extern "C" fn animation_is_static_image<T: PixbufAnimationImpl>(
141146
ptr: *mut ffi::GdkPixbufAnimation,
142147
) -> glib::ffi::gboolean
143148
where
149+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
144150
<T as ObjectSubclass>::Type: IsA<PixbufAnimation>,
145151
{
146152
let instance = &*(ptr as *mut T::Instance);
@@ -154,6 +160,7 @@ unsafe extern "C" fn animation_get_size<T: PixbufAnimationImpl>(
154160
width_ptr: *mut libc::c_int,
155161
height_ptr: *mut libc::c_int,
156162
) where
163+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
157164
<T as ObjectSubclass>::Type: IsA<PixbufAnimation>,
158165
{
159166
if width_ptr.is_null() && height_ptr.is_null() {
@@ -176,6 +183,7 @@ unsafe extern "C" fn animation_get_static_image<T: PixbufAnimationImpl>(
176183
ptr: *mut ffi::GdkPixbufAnimation,
177184
) -> *mut ffi::GdkPixbuf
178185
where
186+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
179187
<T as ObjectSubclass>::Type: IsA<PixbufAnimation>,
180188
{
181189
let instance = &*(ptr as *mut T::Instance);
@@ -209,6 +217,7 @@ unsafe extern "C" fn animation_get_iter<T: PixbufAnimationImpl>(
209217
start_time_ptr: *const glib::ffi::GTimeVal,
210218
) -> *mut ffi::GdkPixbufAnimationIter
211219
where
220+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
212221
<T as ObjectSubclass>::Type: IsA<PixbufAnimation>,
213222
{
214223
let instance = &*(ptr as *mut T::Instance);

gdk-pixbuf/src/subclass/pixbuf_animation_iter.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::{ffi, Pixbuf, PixbufAnimationIter};
1414

1515
pub trait PixbufAnimationIterImpl: ObjectImpl
1616
where
17+
<Self as ObjectSubclass>::Type: IsA<glib::Object>,
1718
<Self as ObjectSubclass>::Type: IsA<PixbufAnimationIter>,
1819
{
1920
// rustdoc-stripper-ignore-next
@@ -37,6 +38,7 @@ where
3738

3839
pub trait PixbufAnimationIterImplExt: ObjectSubclass + PixbufAnimationIterImpl
3940
where
41+
<Self as ObjectSubclass>::Type: IsA<glib::Object>,
4042
<Self as ObjectSubclass>::Type: IsA<PixbufAnimationIter>,
4143
{
4244
fn parent_delay_time(&self) -> Option<Duration> {
@@ -122,13 +124,16 @@ where
122124
}
123125
}
124126

125-
impl<T: PixbufAnimationIterImpl> PixbufAnimationIterImplExt for T where
126-
<T as ObjectSubclass>::Type: IsA<PixbufAnimationIter>
127+
impl<T: PixbufAnimationIterImpl> PixbufAnimationIterImplExt for T
128+
where
129+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
130+
<T as ObjectSubclass>::Type: IsA<PixbufAnimationIter>,
127131
{
128132
}
129133

130134
unsafe impl<T: PixbufAnimationIterImpl> IsSubclassable<T> for PixbufAnimationIter
131135
where
136+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
132137
<T as ObjectSubclass>::Type: IsA<PixbufAnimationIter>,
133138
{
134139
fn class_init(class: &mut ::glib::Class<Self>) {
@@ -146,6 +151,7 @@ unsafe extern "C" fn animation_iter_get_delay_time<T: PixbufAnimationIterImpl>(
146151
ptr: *mut ffi::GdkPixbufAnimationIter,
147152
) -> i32
148153
where
154+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
149155
<T as ObjectSubclass>::Type: IsA<PixbufAnimationIter>,
150156
{
151157
let instance = &*(ptr as *mut T::Instance);
@@ -158,6 +164,7 @@ unsafe extern "C" fn animation_iter_get_pixbuf<T: PixbufAnimationIterImpl>(
158164
ptr: *mut ffi::GdkPixbufAnimationIter,
159165
) -> *mut ffi::GdkPixbuf
160166
where
167+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
161168
<T as ObjectSubclass>::Type: IsA<PixbufAnimationIter>,
162169
{
163170
let instance = &*(ptr as *mut T::Instance);
@@ -177,6 +184,7 @@ unsafe extern "C" fn animation_iter_on_currently_loading_frame<T: PixbufAnimatio
177184
ptr: *mut ffi::GdkPixbufAnimationIter,
178185
) -> glib::ffi::gboolean
179186
where
187+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
180188
<T as ObjectSubclass>::Type: IsA<PixbufAnimationIter>,
181189
{
182190
let instance = &*(ptr as *mut T::Instance);
@@ -190,6 +198,7 @@ unsafe extern "C" fn animation_iter_advance<T: PixbufAnimationIterImpl>(
190198
current_time_ptr: *const glib::ffi::GTimeVal,
191199
) -> glib::ffi::gboolean
192200
where
201+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
193202
<T as ObjectSubclass>::Type: IsA<PixbufAnimationIter>,
194203
{
195204
let instance = &*(ptr as *mut T::Instance);

gdk-pixbuf/src/subclass/pixbuf_loader.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::{ffi, PixbufLoader};
99

1010
pub trait PixbufLoaderImpl: ObjectImpl
1111
where
12+
<Self as ObjectSubclass>::Type: IsA<glib::Object>,
1213
<Self as ObjectSubclass>::Type: IsA<PixbufLoader>,
1314
{
1415
fn size_prepared(&self, width: i32, height: i32) {
@@ -30,6 +31,7 @@ where
3031

3132
pub trait PixbufLoaderImplExt: ObjectSubclass + PixbufLoaderImpl
3233
where
34+
<Self as ObjectSubclass>::Type: IsA<glib::Object>,
3335
<Self as ObjectSubclass>::Type: IsA<PixbufLoader>,
3436
{
3537
fn parent_size_prepared(&self, width: i32, height: i32) {
@@ -97,13 +99,16 @@ where
9799
}
98100
}
99101

100-
impl<T: PixbufLoaderImpl> PixbufLoaderImplExt for T where
101-
<T as ObjectSubclass>::Type: IsA<PixbufLoader>
102+
impl<T: PixbufLoaderImpl> PixbufLoaderImplExt for T
103+
where
104+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
105+
<T as ObjectSubclass>::Type: IsA<PixbufLoader>,
102106
{
103107
}
104108

105109
unsafe impl<T: PixbufLoaderImpl> IsSubclassable<T> for PixbufLoader
106110
where
111+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
107112
<T as ObjectSubclass>::Type: IsA<PixbufLoader>,
108113
{
109114
fn class_init(class: &mut ::glib::Class<Self>) {
@@ -122,6 +127,7 @@ unsafe extern "C" fn loader_size_prepared<T: PixbufLoaderImpl>(
122127
width: i32,
123128
height: i32,
124129
) where
130+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
125131
<T as ObjectSubclass>::Type: IsA<PixbufLoader>,
126132
{
127133
let instance = &*(ptr as *mut T::Instance);
@@ -132,6 +138,7 @@ unsafe extern "C" fn loader_size_prepared<T: PixbufLoaderImpl>(
132138

133139
unsafe extern "C" fn loader_area_prepared<T: PixbufLoaderImpl>(ptr: *mut ffi::GdkPixbufLoader)
134140
where
141+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
135142
<T as ObjectSubclass>::Type: IsA<PixbufLoader>,
136143
{
137144
let instance = &*(ptr as *mut T::Instance);
@@ -147,6 +154,7 @@ unsafe extern "C" fn loader_area_updated<T: PixbufLoaderImpl>(
147154
width: i32,
148155
height: i32,
149156
) where
157+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
150158
<T as ObjectSubclass>::Type: IsA<PixbufLoader>,
151159
{
152160
let instance = &*(ptr as *mut T::Instance);
@@ -157,6 +165,7 @@ unsafe extern "C" fn loader_area_updated<T: PixbufLoaderImpl>(
157165

158166
unsafe extern "C" fn loader_closed<T: PixbufLoaderImpl>(ptr: *mut ffi::GdkPixbufLoader)
159167
where
168+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
160169
<T as ObjectSubclass>::Type: IsA<PixbufLoader>,
161170
{
162171
let instance = &*(ptr as *mut T::Instance);

gio/src/subclass/action_group.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::{ffi, ActionGroup};
88

99
pub trait ActionGroupImpl: ObjectImpl
1010
where
11+
<Self as ObjectSubclass>::Type: IsA<glib::Object>,
1112
<Self as ObjectSubclass>::Type: IsA<ActionGroup>,
1213
{
1314
fn action_added(&self, action_name: &str) {
@@ -78,6 +79,7 @@ where
7879

7980
pub trait ActionGroupImplExt: ObjectSubclass + ActionGroupImpl
8081
where
82+
<Self as ObjectSubclass>::Type: IsA<glib::Object>,
8183
<Self as ObjectSubclass>::Type: IsA<ActionGroup>,
8284
{
8385
fn parent_action_added(&self, action_name: &str) {
@@ -342,11 +344,16 @@ where
342344
}
343345
}
344346

345-
impl<T: ActionGroupImpl> ActionGroupImplExt for T where <T as ObjectSubclass>::Type: IsA<ActionGroup>
346-
{}
347+
impl<T: ActionGroupImpl> ActionGroupImplExt for T
348+
where
349+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
350+
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
351+
{
352+
}
347353

348354
unsafe impl<T: ActionGroupImpl> IsImplementable<T> for ActionGroup
349355
where
356+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
350357
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
351358
{
352359
fn interface_init(iface: &mut glib::Interface<Self>) {
@@ -374,6 +381,7 @@ unsafe extern "C" fn action_group_has_action<T: ActionGroupImpl>(
374381
action_nameptr: *const libc::c_char,
375382
) -> glib::ffi::gboolean
376383
where
384+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
377385
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
378386
{
379387
let instance = &*(action_group as *mut T::Instance);
@@ -388,6 +396,7 @@ unsafe extern "C" fn action_group_get_action_enabled<T: ActionGroupImpl>(
388396
action_nameptr: *const libc::c_char,
389397
) -> glib::ffi::gboolean
390398
where
399+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
391400
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
392401
{
393402
let instance = &*(action_group as *mut T::Instance);
@@ -412,6 +421,7 @@ unsafe extern "C" fn action_group_get_action_parameter_type<T: ActionGroupImpl>(
412421
action_nameptr: *const libc::c_char,
413422
) -> *const glib::ffi::GVariantType
414423
where
424+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
415425
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
416426
{
417427
let instance = &*(action_group as *mut T::Instance);
@@ -444,6 +454,7 @@ unsafe extern "C" fn action_group_get_action_state_type<T: ActionGroupImpl>(
444454
action_nameptr: *const libc::c_char,
445455
) -> *const glib::ffi::GVariantType
446456
where
457+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
447458
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
448459
{
449460
let instance = &*(action_group as *mut T::Instance);
@@ -476,6 +487,7 @@ unsafe extern "C" fn action_group_get_action_state_hint<T: ActionGroupImpl>(
476487
action_nameptr: *const libc::c_char,
477488
) -> *mut glib::ffi::GVariant
478489
where
490+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
479491
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
480492
{
481493
let instance = &*(action_group as *mut T::Instance);
@@ -507,6 +519,7 @@ unsafe extern "C" fn action_group_get_action_state<T: ActionGroupImpl>(
507519
action_nameptr: *const libc::c_char,
508520
) -> *mut glib::ffi::GVariant
509521
where
522+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
510523
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
511524
{
512525
let instance = &*(action_group as *mut T::Instance);
@@ -536,6 +549,7 @@ unsafe extern "C" fn action_group_change_action_state<T: ActionGroupImpl>(
536549
action_nameptr: *const libc::c_char,
537550
stateptr: *mut glib::ffi::GVariant,
538551
) where
552+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
539553
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
540554
{
541555
let instance = &*(action_group as *mut T::Instance);
@@ -551,6 +565,7 @@ unsafe extern "C" fn action_group_activate_action<T: ActionGroupImpl>(
551565
action_nameptr: *const libc::c_char,
552566
parameterptr: *mut glib::ffi::GVariant,
553567
) where
568+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
554569
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
555570
{
556571
let instance = &*(action_group as *mut T::Instance);
@@ -565,6 +580,7 @@ unsafe extern "C" fn action_group_action_added<T: ActionGroupImpl>(
565580
action_group: *mut ffi::GActionGroup,
566581
action_nameptr: *const libc::c_char,
567582
) where
583+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
568584
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
569585
{
570586
let instance = &*(action_group as *mut T::Instance);
@@ -578,6 +594,7 @@ unsafe extern "C" fn action_group_action_removed<T: ActionGroupImpl>(
578594
action_group: *mut ffi::GActionGroup,
579595
action_nameptr: *const libc::c_char,
580596
) where
597+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
581598
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
582599
{
583600
let instance = &*(action_group as *mut T::Instance);
@@ -592,6 +609,7 @@ unsafe extern "C" fn action_group_action_enabled_changed<T: ActionGroupImpl>(
592609
action_nameptr: *const libc::c_char,
593610
enabled: glib::ffi::gboolean,
594611
) where
612+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
595613
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
596614
{
597615
let instance = &*(action_group as *mut T::Instance);
@@ -606,6 +624,7 @@ unsafe extern "C" fn action_group_action_state_changed<T: ActionGroupImpl>(
606624
action_nameptr: *const libc::c_char,
607625
stateptr: *mut glib::ffi::GVariant,
608626
) where
627+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
609628
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
610629
{
611630
let instance = &*(action_group as *mut T::Instance);
@@ -620,6 +639,7 @@ unsafe extern "C" fn action_group_list_actions<T: ActionGroupImpl>(
620639
action_group: *mut ffi::GActionGroup,
621640
) -> *mut *mut libc::c_char
622641
where
642+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
623643
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
624644
{
625645
let instance = &*(action_group as *mut T::Instance);
@@ -649,6 +669,7 @@ unsafe extern "C" fn action_group_query_action<T: ActionGroupImpl>(
649669
state: *mut *mut glib::ffi::GVariant,
650670
) -> glib::ffi::gboolean
651671
where
672+
<T as ObjectSubclass>::Type: IsA<glib::Object>,
652673
<T as ObjectSubclass>::Type: IsA<ActionGroup>,
653674
{
654675
let instance = &*(action_group as *mut T::Instance);

0 commit comments

Comments
 (0)