Skip to content

Commit 9803151

Browse files
committed
regenerate: more Into<Option<_>> in arg position
1 parent 240ec2c commit 9803151

File tree

111 files changed

+3808
-1955
lines changed

Some content is hidden

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

111 files changed

+3808
-1955
lines changed

gdk-pixbuf/src/auto/pixbuf.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,20 @@ impl Pixbuf {
167167

168168
#[doc(alias = "gdk_pixbuf_new_from_stream")]
169169
#[doc(alias = "new_from_stream")]
170-
pub fn from_stream(
170+
pub fn from_stream<'a, P: IsA<gio::Cancellable>>(
171171
stream: &impl IsA<gio::InputStream>,
172-
cancellable: Option<&impl IsA<gio::Cancellable>>,
172+
cancellable: impl Into<Option<&'a P>>,
173173
) -> Result<Pixbuf, glib::Error> {
174174
unsafe {
175175
let mut error = std::ptr::null_mut();
176176
let ret = ffi::gdk_pixbuf_new_from_stream(
177177
stream.as_ref().to_glib_none().0,
178-
cancellable.map(|p| p.as_ref()).to_glib_none().0,
178+
cancellable
179+
.into()
180+
.as_ref()
181+
.map(|p| p.as_ref())
182+
.to_glib_none()
183+
.0,
179184
&mut error,
180185
);
181186
if error.is_null() {
@@ -188,12 +193,12 @@ impl Pixbuf {
188193

189194
#[doc(alias = "gdk_pixbuf_new_from_stream_at_scale")]
190195
#[doc(alias = "new_from_stream_at_scale")]
191-
pub fn from_stream_at_scale(
196+
pub fn from_stream_at_scale<'a, P: IsA<gio::Cancellable>>(
192197
stream: &impl IsA<gio::InputStream>,
193198
width: i32,
194199
height: i32,
195200
preserve_aspect_ratio: bool,
196-
cancellable: Option<&impl IsA<gio::Cancellable>>,
201+
cancellable: impl Into<Option<&'a P>>,
197202
) -> Result<Pixbuf, glib::Error> {
198203
unsafe {
199204
let mut error = std::ptr::null_mut();
@@ -202,7 +207,12 @@ impl Pixbuf {
202207
width,
203208
height,
204209
preserve_aspect_ratio.into_glib(),
205-
cancellable.map(|p| p.as_ref()).to_glib_none().0,
210+
cancellable
211+
.into()
212+
.as_ref()
213+
.map(|p| p.as_ref())
214+
.to_glib_none()
215+
.0,
206216
&mut error,
207217
);
208218
if error.is_null() {
@@ -534,17 +544,17 @@ impl Pixbuf {
534544
}
535545

536546
//#[doc(alias = "gdk_pixbuf_save")]
537-
//pub fn save(&self, filename: impl AsRef<std::path::Path>, type_: &str, error: Option<&mut glib::Error>, : /*Unimplemented*/Basic: VarArgs) -> bool {
547+
//pub fn save<'a>(&self, filename: impl AsRef<std::path::Path>, type_: &str, error: impl Into<Option<&'a mut glib::Error>>, : /*Unimplemented*/Basic: VarArgs) -> bool {
538548
// unsafe { TODO: call ffi:gdk_pixbuf_save() }
539549
//}
540550

541551
//#[doc(alias = "gdk_pixbuf_save_to_buffer")]
542-
//pub fn save_to_buffer(&self, type_: &str, error: Option<&mut glib::Error>, : /*Unimplemented*/Basic: VarArgs) -> Option<Vec<u8>> {
552+
//pub fn save_to_buffer<'a>(&self, type_: &str, error: impl Into<Option<&'a mut glib::Error>>, : /*Unimplemented*/Basic: VarArgs) -> Option<Vec<u8>> {
543553
// unsafe { TODO: call ffi:gdk_pixbuf_save_to_buffer() }
544554
//}
545555

546556
//#[doc(alias = "gdk_pixbuf_save_to_callback")]
547-
//pub fn save_to_callback<P: FnMut(&[u8], usize, &glib::Error) -> bool>(&self, save_func: P, type_: &str, error: Option<&mut glib::Error>, : /*Unimplemented*/Basic: VarArgs) -> bool {
557+
//pub fn save_to_callback<'a, P: FnMut(&[u8], usize, &glib::Error) -> bool>(&self, save_func: P, type_: &str, error: impl Into<Option<&'a mut glib::Error>>, : /*Unimplemented*/Basic: VarArgs) -> bool {
548558
// unsafe { TODO: call ffi:gdk_pixbuf_save_to_callback() }
549559
//}
550560

@@ -554,12 +564,12 @@ impl Pixbuf {
554564
//}
555565

556566
//#[doc(alias = "gdk_pixbuf_save_to_stream")]
557-
//pub fn save_to_stream(&self, stream: &impl IsA<gio::OutputStream>, type_: &str, cancellable: Option<&impl IsA<gio::Cancellable>>, error: Option<&mut glib::Error>, : /*Unimplemented*/Basic: VarArgs) -> bool {
567+
//pub fn save_to_stream<'a, P: IsA<gio::Cancellable>>(&self, stream: &impl IsA<gio::OutputStream>, type_: &str, cancellable: impl Into<Option<&'a P>>, error: impl Into<Option<&'a mut glib::Error>>, : /*Unimplemented*/Basic: VarArgs) -> bool {
558568
// unsafe { TODO: call ffi:gdk_pixbuf_save_to_stream() }
559569
//}
560570

561571
//#[doc(alias = "gdk_pixbuf_save_to_stream_async")]
562-
//pub fn save_to_stream_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, stream: &impl IsA<gio::OutputStream>, type_: &str, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P, : /*Unimplemented*/Basic: VarArgs) {
572+
//pub fn save_to_stream_async<'a, P: IsA<gio::Cancellable>, Q: FnOnce(Result<(), glib::Error>) + 'static>(&self, stream: &impl IsA<gio::OutputStream>, type_: &str, cancellable: impl Into<Option<&'a P>>, callback: Q, : /*Unimplemented*/Basic: VarArgs) {
563573
// unsafe { TODO: call ffi:gdk_pixbuf_save_to_stream_async() }
564574
//}
565575

gdk-pixbuf/src/auto/pixbuf_animation.rs

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,20 @@ impl PixbufAnimation {
5656

5757
#[doc(alias = "gdk_pixbuf_animation_new_from_stream")]
5858
#[doc(alias = "new_from_stream")]
59-
pub fn from_stream(
59+
pub fn from_stream<'a, P: IsA<gio::Cancellable>>(
6060
stream: &impl IsA<gio::InputStream>,
61-
cancellable: Option<&impl IsA<gio::Cancellable>>,
61+
cancellable: impl Into<Option<&'a P>>,
6262
) -> Result<PixbufAnimation, glib::Error> {
6363
unsafe {
6464
let mut error = std::ptr::null_mut();
6565
let ret = ffi::gdk_pixbuf_animation_new_from_stream(
6666
stream.as_ref().to_glib_none().0,
67-
cancellable.map(|p| p.as_ref()).to_glib_none().0,
67+
cancellable
68+
.into()
69+
.as_ref()
70+
.map(|p| p.as_ref())
71+
.to_glib_none()
72+
.0,
6873
&mut error,
6974
);
7075
if error.is_null() {
@@ -77,10 +82,14 @@ impl PixbufAnimation {
7782

7883
#[doc(alias = "gdk_pixbuf_animation_new_from_stream_async")]
7984
#[doc(alias = "new_from_stream_async")]
80-
pub fn from_stream_async<P: FnOnce(Result<PixbufAnimation, glib::Error>) + 'static>(
85+
pub fn from_stream_async<
86+
'a,
87+
P: IsA<gio::Cancellable>,
88+
Q: FnOnce(Result<PixbufAnimation, glib::Error>) + 'static,
89+
>(
8190
stream: &impl IsA<gio::InputStream>,
82-
cancellable: Option<&impl IsA<gio::Cancellable>>,
83-
callback: P,
91+
cancellable: impl Into<Option<&'a P>>,
92+
callback: Q,
8493
) {
8594
let main_context = glib::MainContext::ref_thread_default();
8695
let is_main_context_owner = main_context.is_owner();
@@ -92,10 +101,10 @@ impl PixbufAnimation {
92101
"Async operations only allowed if the thread is owning the MainContext"
93102
);
94103

95-
let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
104+
let user_data: Box_<glib::thread_guard::ThreadGuard<Q>> =
96105
Box_::new(glib::thread_guard::ThreadGuard::new(callback));
97106
unsafe extern "C" fn from_stream_async_trampoline<
98-
P: FnOnce(Result<PixbufAnimation, glib::Error>) + 'static,
107+
Q: FnOnce(Result<PixbufAnimation, glib::Error>) + 'static,
99108
>(
100109
_source_object: *mut glib::gobject_ffi::GObject,
101110
res: *mut gio::ffi::GAsyncResult,
@@ -108,16 +117,21 @@ impl PixbufAnimation {
108117
} else {
109118
Err(from_glib_full(error))
110119
};
111-
let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
120+
let callback: Box_<glib::thread_guard::ThreadGuard<Q>> =
112121
Box_::from_raw(user_data as *mut _);
113-
let callback: P = callback.into_inner();
122+
let callback: Q = callback.into_inner();
114123
callback(result);
115124
}
116-
let callback = from_stream_async_trampoline::<P>;
125+
let callback = from_stream_async_trampoline::<Q>;
117126
unsafe {
118127
ffi::gdk_pixbuf_animation_new_from_stream_async(
119128
stream.as_ref().to_glib_none().0,
120-
cancellable.map(|p| p.as_ref()).to_glib_none().0,
129+
cancellable
130+
.into()
131+
.as_ref()
132+
.map(|p| p.as_ref())
133+
.to_glib_none()
134+
.0,
121135
Some(callback),
122136
Box_::into_raw(user_data) as *mut _,
123137
);

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 @ ae29aefbe96a)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 24f0d6639caa)
22
from gir-files (https://github.com/gtk-rs/gir-files @ dfdf5ed146d5)

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 @ ae29aefbe96a)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 24f0d6639caa)
22
from gir-files (https://github.com/gtk-rs/gir-files @ dfdf5ed146d5)

gio/src/auto/action.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,27 @@ impl Action {
5151
}
5252

5353
#[doc(alias = "g_action_print_detailed_name")]
54-
pub fn print_detailed_name(
54+
pub fn print_detailed_name<'a>(
5555
action_name: &str,
56-
target_value: Option<&glib::Variant>,
56+
target_value: impl Into<Option<&'a glib::Variant>>,
5757
) -> glib::GString {
5858
unsafe {
5959
from_glib_full(ffi::g_action_print_detailed_name(
6060
action_name.to_glib_none().0,
61-
target_value.to_glib_none().0,
61+
target_value.into().to_glib_none().0,
6262
))
6363
}
6464
}
6565
}
6666

6767
pub trait ActionExt: IsA<Action> + 'static {
6868
#[doc(alias = "g_action_activate")]
69-
fn activate(&self, parameter: Option<&glib::Variant>) {
69+
fn activate<'a>(&self, parameter: impl Into<Option<&'a glib::Variant>>) {
7070
unsafe {
71-
ffi::g_action_activate(self.as_ref().to_glib_none().0, parameter.to_glib_none().0);
71+
ffi::g_action_activate(
72+
self.as_ref().to_glib_none().0,
73+
parameter.into().to_glib_none().0,
74+
);
7275
}
7376
}
7477

gio/src/auto/action_group.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,16 @@ pub trait ActionGroupExt: IsA<ActionGroup> + 'static {
6767
}
6868

6969
#[doc(alias = "g_action_group_activate_action")]
70-
fn activate_action(&self, action_name: &str, parameter: Option<&glib::Variant>) {
70+
fn activate_action<'a>(
71+
&self,
72+
action_name: &str,
73+
parameter: impl Into<Option<&'a glib::Variant>>,
74+
) {
7175
unsafe {
7276
ffi::g_action_group_activate_action(
7377
self.as_ref().to_glib_none().0,
7478
action_name.to_glib_none().0,
75-
parameter.to_glib_none().0,
79+
parameter.into().to_glib_none().0,
7680
);
7781
}
7882
}

0 commit comments

Comments
 (0)