Skip to content

Commit 1a423f2

Browse files
committed
gir: Update and regenerate with impl Trait instead of named types
gtk-rs/gir#1153
1 parent 23cc7cb commit 1a423f2

File tree

99 files changed

+1923
-2409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1923
-2409
lines changed

gdk-pixbuf/src/auto/pixbuf.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ impl Pixbuf {
113113

114114
#[doc(alias = "gdk_pixbuf_new_from_stream")]
115115
#[doc(alias = "new_from_stream")]
116-
pub fn from_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(
117-
stream: &P,
118-
cancellable: Option<&Q>,
116+
pub fn from_stream(
117+
stream: &impl IsA<gio::InputStream>,
118+
cancellable: Option<&impl IsA<gio::Cancellable>>,
119119
) -> Result<Pixbuf, glib::Error> {
120120
unsafe {
121121
let mut error = ptr::null_mut();
@@ -134,12 +134,12 @@ impl Pixbuf {
134134

135135
#[doc(alias = "gdk_pixbuf_new_from_stream_at_scale")]
136136
#[doc(alias = "new_from_stream_at_scale")]
137-
pub fn from_stream_at_scale<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(
138-
stream: &P,
137+
pub fn from_stream_at_scale(
138+
stream: &impl IsA<gio::InputStream>,
139139
width: i32,
140140
height: i32,
141141
preserve_aspect_ratio: bool,
142-
cancellable: Option<&Q>,
142+
cancellable: Option<&impl IsA<gio::Cancellable>>,
143143
) -> Result<Pixbuf, glib::Error> {
144144
unsafe {
145145
let mut error = ptr::null_mut();
@@ -465,7 +465,7 @@ impl Pixbuf {
465465
}
466466

467467
//#[doc(alias = "gdk_pixbuf_save")]
468-
//pub fn save<P: AsRef<std::path::Path>>(&self, filename: P, type_: &str, error: Option<&mut glib::Error>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
468+
//pub fn save(&self, filename: impl AsRef<std::path::Path>, type_: &str, error: Option<&mut glib::Error>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
469469
// unsafe { TODO: call ffi:gdk_pixbuf_save() }
470470
//}
471471

@@ -485,17 +485,17 @@ impl Pixbuf {
485485
//}
486486

487487
//#[doc(alias = "gdk_pixbuf_save_to_stream")]
488-
//pub fn save_to_stream<P: IsA<gio::OutputStream>, Q: IsA<gio::Cancellable>>(&self, stream: &P, type_: &str, cancellable: Option<&Q>, error: Option<&mut glib::Error>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
488+
//pub fn save_to_stream(&self, stream: &impl IsA<gio::OutputStream>, type_: &str, cancellable: Option<&impl IsA<gio::Cancellable>>, error: Option<&mut glib::Error>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
489489
// unsafe { TODO: call ffi:gdk_pixbuf_save_to_stream() }
490490
//}
491491

492492
//#[doc(alias = "gdk_pixbuf_save_to_stream_async")]
493-
//pub fn save_to_stream_async<P: IsA<gio::OutputStream>, Q: IsA<gio::Cancellable>, R: FnOnce(Result<(), glib::Error>) + Send + 'static>(&self, stream: &P, type_: &str, cancellable: Option<&Q>, callback: R, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
493+
//pub fn save_to_stream_async<P: FnOnce(Result<(), glib::Error>) + Send + 'static>(&self, stream: &impl IsA<gio::OutputStream>, type_: &str, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
494494
// unsafe { TODO: call ffi:gdk_pixbuf_save_to_stream_async() }
495495
//}
496496

497497
//
498-
//pub fn save_to_stream_async_future<P: IsA<gio::OutputStream> + Clone + 'static>(&self, stream: &P, type_: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
498+
//pub fn save_to_stream_async_future(&self, stream: &(impl IsA<gio::OutputStream> + Clone + 'static), type_: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
499499

500500
//let stream = stream.clone();
501501
//let type_ = String::from(type_);

gdk-pixbuf/src/auto/pixbuf_animation.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ glib::wrapper! {
2222
impl PixbufAnimation {
2323
#[doc(alias = "gdk_pixbuf_animation_new_from_file")]
2424
#[doc(alias = "new_from_file")]
25-
pub fn from_file<P: AsRef<std::path::Path>>(
26-
filename: P,
25+
pub fn from_file(
26+
filename: impl AsRef<std::path::Path>,
2727
) -> Result<PixbufAnimation, glib::Error> {
2828
unsafe {
2929
let mut error = ptr::null_mut();
@@ -58,9 +58,9 @@ impl PixbufAnimation {
5858

5959
#[doc(alias = "gdk_pixbuf_animation_new_from_stream")]
6060
#[doc(alias = "new_from_stream")]
61-
pub fn from_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(
62-
stream: &P,
63-
cancellable: Option<&Q>,
61+
pub fn from_stream(
62+
stream: &impl IsA<gio::InputStream>,
63+
cancellable: Option<&impl IsA<gio::Cancellable>>,
6464
) -> Result<PixbufAnimation, glib::Error> {
6565
unsafe {
6666
let mut error = ptr::null_mut();
@@ -79,18 +79,14 @@ impl PixbufAnimation {
7979

8080
#[doc(alias = "gdk_pixbuf_animation_new_from_stream_async")]
8181
#[doc(alias = "new_from_stream_async")]
82-
pub fn from_stream_async<
83-
P: IsA<gio::InputStream>,
84-
Q: IsA<gio::Cancellable>,
85-
R: FnOnce(Result<PixbufAnimation, glib::Error>) + Send + 'static,
86-
>(
87-
stream: &P,
88-
cancellable: Option<&Q>,
89-
callback: R,
82+
pub fn from_stream_async<P: FnOnce(Result<PixbufAnimation, glib::Error>) + Send + 'static>(
83+
stream: &impl IsA<gio::InputStream>,
84+
cancellable: Option<&impl IsA<gio::Cancellable>>,
85+
callback: P,
9086
) {
91-
let user_data: Box_<R> = Box_::new(callback);
87+
let user_data: Box_<P> = Box_::new(callback);
9288
unsafe extern "C" fn from_stream_async_trampoline<
93-
R: FnOnce(Result<PixbufAnimation, glib::Error>) + Send + 'static,
89+
P: FnOnce(Result<PixbufAnimation, glib::Error>) + Send + 'static,
9490
>(
9591
_source_object: *mut glib::gobject_ffi::GObject,
9692
res: *mut gio::ffi::GAsyncResult,
@@ -103,10 +99,10 @@ impl PixbufAnimation {
10399
} else {
104100
Err(from_glib_full(error))
105101
};
106-
let callback: Box_<R> = Box_::from_raw(user_data as *mut _);
102+
let callback: Box_<P> = Box_::from_raw(user_data as *mut _);
107103
callback(result);
108104
}
109-
let callback = from_stream_async_trampoline::<R>;
105+
let callback = from_stream_async_trampoline::<P>;
110106
unsafe {
111107
ffi::gdk_pixbuf_animation_new_from_stream_async(
112108
stream.as_ref().to_glib_none().0,
@@ -117,8 +113,8 @@ impl PixbufAnimation {
117113
}
118114
}
119115

120-
pub fn from_stream_async_future<P: IsA<gio::InputStream> + Clone + 'static>(
121-
stream: &P,
116+
pub fn from_stream_async_future(
117+
stream: &(impl IsA<gio::InputStream> + Clone + 'static),
122118
) -> Pin<Box_<dyn std::future::Future<Output = Result<PixbufAnimation, glib::Error>> + 'static>>
123119
{
124120
let stream = stream.clone();

gdk-pixbuf/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 3158f69)
1+
Generated by gir (https://github.com/gtk-rs/gir @ ee35a13)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 7d95377)

gdk-pixbuf/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 3158f69)
1+
Generated by gir (https://github.com/gtk-rs/gir @ ee35a13)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 7d95377)

gio/src/auto/action_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub const NONE_ACTION_MAP: Option<&ActionMap> = None;
2020

2121
pub trait ActionMapExt: 'static {
2222
#[doc(alias = "g_action_map_add_action")]
23-
fn add_action<P: IsA<Action>>(&self, action: &P);
23+
fn add_action(&self, action: &impl IsA<Action>);
2424

2525
//#[doc(alias = "g_action_map_add_action_entries")]
2626
//fn add_action_entries(&self, entries: /*Ignored*/&[&ActionEntry], user_data: /*Unimplemented*/Option<Fundamental: Pointer>);
@@ -33,7 +33,7 @@ pub trait ActionMapExt: 'static {
3333
}
3434

3535
impl<O: IsA<ActionMap>> ActionMapExt for O {
36-
fn add_action<P: IsA<Action>>(&self, action: &P) {
36+
fn add_action(&self, action: &impl IsA<Action>) {
3737
unsafe {
3838
ffi::g_action_map_add_action(
3939
self.as_ref().to_glib_none().0,

gio/src/auto/app_info.rs

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ glib::wrapper! {
3434

3535
impl AppInfo {
3636
#[doc(alias = "g_app_info_create_from_commandline")]
37-
pub fn create_from_commandline<P: AsRef<std::ffi::OsStr>>(
38-
commandline: P,
37+
pub fn create_from_commandline(
38+
commandline: impl AsRef<std::ffi::OsStr>,
3939
application_name: Option<&str>,
4040
flags: AppInfoCreateFlags,
4141
) -> Result<AppInfo, glib::Error> {
@@ -113,9 +113,9 @@ impl AppInfo {
113113
}
114114

115115
#[doc(alias = "g_app_info_launch_default_for_uri")]
116-
pub fn launch_default_for_uri<P: IsA<AppLaunchContext>>(
116+
pub fn launch_default_for_uri(
117117
uri: &str,
118-
context: Option<&P>,
118+
context: Option<&impl IsA<AppLaunchContext>>,
119119
) -> Result<(), glib::Error> {
120120
unsafe {
121121
let mut error = ptr::null_mut();
@@ -135,19 +135,15 @@ impl AppInfo {
135135
#[cfg(any(feature = "v2_50", feature = "dox"))]
136136
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
137137
#[doc(alias = "g_app_info_launch_default_for_uri_async")]
138-
pub fn launch_default_for_uri_async<
139-
P: IsA<AppLaunchContext>,
140-
Q: IsA<Cancellable>,
141-
R: FnOnce(Result<(), glib::Error>) + Send + 'static,
142-
>(
138+
pub fn launch_default_for_uri_async<P: FnOnce(Result<(), glib::Error>) + Send + 'static>(
143139
uri: &str,
144-
context: Option<&P>,
145-
cancellable: Option<&Q>,
146-
callback: R,
140+
context: Option<&impl IsA<AppLaunchContext>>,
141+
cancellable: Option<&impl IsA<Cancellable>>,
142+
callback: P,
147143
) {
148-
let user_data: Box_<R> = Box_::new(callback);
144+
let user_data: Box_<P> = Box_::new(callback);
149145
unsafe extern "C" fn launch_default_for_uri_async_trampoline<
150-
R: FnOnce(Result<(), glib::Error>) + Send + 'static,
146+
P: FnOnce(Result<(), glib::Error>) + Send + 'static,
151147
>(
152148
_source_object: *mut glib::gobject_ffi::GObject,
153149
res: *mut crate::ffi::GAsyncResult,
@@ -160,10 +156,10 @@ impl AppInfo {
160156
} else {
161157
Err(from_glib_full(error))
162158
};
163-
let callback: Box_<R> = Box_::from_raw(user_data as *mut _);
159+
let callback: Box_<P> = Box_::from_raw(user_data as *mut _);
164160
callback(result);
165161
}
166-
let callback = launch_default_for_uri_async_trampoline::<R>;
162+
let callback = launch_default_for_uri_async_trampoline::<P>;
167163
unsafe {
168164
ffi::g_app_info_launch_default_for_uri_async(
169165
uri.to_glib_none().0,
@@ -177,9 +173,9 @@ impl AppInfo {
177173

178174
#[cfg(any(feature = "v2_50", feature = "dox"))]
179175
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
180-
pub fn launch_default_for_uri_async_future<P: IsA<AppLaunchContext> + Clone + 'static>(
176+
pub fn launch_default_for_uri_async_future(
181177
uri: &str,
182-
context: Option<&P>,
178+
context: Option<&(impl IsA<AppLaunchContext> + Clone + 'static)>,
183179
) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
184180
let uri = String::from(uri);
185181
let context = context.map(ToOwned::to_owned);
@@ -225,7 +221,7 @@ pub trait AppInfoExt: 'static {
225221
fn dup(&self) -> AppInfo;
226222

227223
#[doc(alias = "g_app_info_equal")]
228-
fn equal<P: IsA<AppInfo>>(&self, appinfo2: &P) -> bool;
224+
fn equal(&self, appinfo2: &impl IsA<AppInfo>) -> bool;
229225

230226
#[doc(alias = "g_app_info_get_commandline")]
231227
#[doc(alias = "get_commandline")]
@@ -260,26 +256,26 @@ pub trait AppInfoExt: 'static {
260256
fn supported_types(&self) -> Vec<glib::GString>;
261257

262258
#[doc(alias = "g_app_info_launch")]
263-
fn launch<P: IsA<AppLaunchContext>>(
259+
fn launch(
264260
&self,
265261
files: &[File],
266-
context: Option<&P>,
262+
context: Option<&impl IsA<AppLaunchContext>>,
267263
) -> Result<(), glib::Error>;
268264

269265
#[doc(alias = "g_app_info_launch_uris")]
270-
fn launch_uris<P: IsA<AppLaunchContext>>(
266+
fn launch_uris(
271267
&self,
272268
uris: &[&str],
273-
context: Option<&P>,
269+
context: Option<&impl IsA<AppLaunchContext>>,
274270
) -> Result<(), glib::Error>;
275271

276272
#[doc(alias = "g_app_info_remove_supports_type")]
277273
fn remove_supports_type(&self, content_type: &str) -> Result<(), glib::Error>;
278274

279275
#[doc(alias = "g_app_info_set_as_default_for_extension")]
280-
fn set_as_default_for_extension<P: AsRef<std::path::Path>>(
276+
fn set_as_default_for_extension(
281277
&self,
282-
extension: P,
278+
extension: impl AsRef<std::path::Path>,
283279
) -> Result<(), glib::Error>;
284280

285281
#[doc(alias = "g_app_info_set_as_default_for_type")]
@@ -335,7 +331,7 @@ impl<O: IsA<AppInfo>> AppInfoExt for O {
335331
unsafe { from_glib_full(ffi::g_app_info_dup(self.as_ref().to_glib_none().0)) }
336332
}
337333

338-
fn equal<P: IsA<AppInfo>>(&self, appinfo2: &P) -> bool {
334+
fn equal(&self, appinfo2: &impl IsA<AppInfo>) -> bool {
339335
unsafe {
340336
from_glib(ffi::g_app_info_equal(
341337
self.as_ref().to_glib_none().0,
@@ -396,10 +392,10 @@ impl<O: IsA<AppInfo>> AppInfoExt for O {
396392
}
397393
}
398394

399-
fn launch<P: IsA<AppLaunchContext>>(
395+
fn launch(
400396
&self,
401397
files: &[File],
402-
context: Option<&P>,
398+
context: Option<&impl IsA<AppLaunchContext>>,
403399
) -> Result<(), glib::Error> {
404400
unsafe {
405401
let mut error = ptr::null_mut();
@@ -417,10 +413,10 @@ impl<O: IsA<AppInfo>> AppInfoExt for O {
417413
}
418414
}
419415

420-
fn launch_uris<P: IsA<AppLaunchContext>>(
416+
fn launch_uris(
421417
&self,
422418
uris: &[&str],
423-
context: Option<&P>,
419+
context: Option<&impl IsA<AppLaunchContext>>,
424420
) -> Result<(), glib::Error> {
425421
unsafe {
426422
let mut error = ptr::null_mut();
@@ -454,9 +450,9 @@ impl<O: IsA<AppInfo>> AppInfoExt for O {
454450
}
455451
}
456452

457-
fn set_as_default_for_extension<P: AsRef<std::path::Path>>(
453+
fn set_as_default_for_extension(
458454
&self,
459-
extension: P,
455+
extension: impl AsRef<std::path::Path>,
460456
) -> Result<(), glib::Error> {
461457
unsafe {
462458
let mut error = ptr::null_mut();

gio/src/auto/app_launch_context.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,24 @@ pub const NONE_APP_LAUNCH_CONTEXT: Option<&AppLaunchContext> = None;
4040
pub trait AppLaunchContextExt: 'static {
4141
#[doc(alias = "g_app_launch_context_get_display")]
4242
#[doc(alias = "get_display")]
43-
fn display<P: IsA<AppInfo>>(&self, info: &P, files: &[File]) -> Option<glib::GString>;
43+
fn display(&self, info: &impl IsA<AppInfo>, files: &[File]) -> Option<glib::GString>;
4444

4545
#[doc(alias = "g_app_launch_context_get_environment")]
4646
#[doc(alias = "get_environment")]
4747
fn environment(&self) -> Vec<std::ffi::OsString>;
4848

4949
#[doc(alias = "g_app_launch_context_get_startup_notify_id")]
5050
#[doc(alias = "get_startup_notify_id")]
51-
fn startup_notify_id<P: IsA<AppInfo>>(&self, info: &P, files: &[File])
52-
-> Option<glib::GString>;
51+
fn startup_notify_id(&self, info: &impl IsA<AppInfo>, files: &[File]) -> Option<glib::GString>;
5352

5453
#[doc(alias = "g_app_launch_context_launch_failed")]
5554
fn launch_failed(&self, startup_notify_id: &str);
5655

5756
#[doc(alias = "g_app_launch_context_setenv")]
58-
fn setenv<P: AsRef<std::ffi::OsStr>, Q: AsRef<std::ffi::OsStr>>(&self, variable: P, value: Q);
57+
fn setenv(&self, variable: impl AsRef<std::ffi::OsStr>, value: impl AsRef<std::ffi::OsStr>);
5958

6059
#[doc(alias = "g_app_launch_context_unsetenv")]
61-
fn unsetenv<P: AsRef<std::ffi::OsStr>>(&self, variable: P);
60+
fn unsetenv(&self, variable: impl AsRef<std::ffi::OsStr>);
6261

6362
#[doc(alias = "launch-failed")]
6463
fn connect_launch_failed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
@@ -71,7 +70,7 @@ pub trait AppLaunchContextExt: 'static {
7170
}
7271

7372
impl<O: IsA<AppLaunchContext>> AppLaunchContextExt for O {
74-
fn display<P: IsA<AppInfo>>(&self, info: &P, files: &[File]) -> Option<glib::GString> {
73+
fn display(&self, info: &impl IsA<AppInfo>, files: &[File]) -> Option<glib::GString> {
7574
unsafe {
7675
from_glib_full(ffi::g_app_launch_context_get_display(
7776
self.as_ref().to_glib_none().0,
@@ -89,11 +88,7 @@ impl<O: IsA<AppLaunchContext>> AppLaunchContextExt for O {
8988
}
9089
}
9190

92-
fn startup_notify_id<P: IsA<AppInfo>>(
93-
&self,
94-
info: &P,
95-
files: &[File],
96-
) -> Option<glib::GString> {
91+
fn startup_notify_id(&self, info: &impl IsA<AppInfo>, files: &[File]) -> Option<glib::GString> {
9792
unsafe {
9893
from_glib_full(ffi::g_app_launch_context_get_startup_notify_id(
9994
self.as_ref().to_glib_none().0,
@@ -112,7 +107,7 @@ impl<O: IsA<AppLaunchContext>> AppLaunchContextExt for O {
112107
}
113108
}
114109

115-
fn setenv<P: AsRef<std::ffi::OsStr>, Q: AsRef<std::ffi::OsStr>>(&self, variable: P, value: Q) {
110+
fn setenv(&self, variable: impl AsRef<std::ffi::OsStr>, value: impl AsRef<std::ffi::OsStr>) {
116111
unsafe {
117112
ffi::g_app_launch_context_setenv(
118113
self.as_ref().to_glib_none().0,
@@ -122,7 +117,7 @@ impl<O: IsA<AppLaunchContext>> AppLaunchContextExt for O {
122117
}
123118
}
124119

125-
fn unsetenv<P: AsRef<std::ffi::OsStr>>(&self, variable: P) {
120+
fn unsetenv(&self, variable: impl AsRef<std::ffi::OsStr>) {
126121
unsafe {
127122
ffi::g_app_launch_context_unsetenv(
128123
self.as_ref().to_glib_none().0,

0 commit comments

Comments
 (0)