Skip to content

Commit 3b2dc89

Browse files
tautropflisdroege
authored andcommitted
Split async+callback methods into overloads with and without fn
1 parent 22c2db4 commit 3b2dc89

File tree

1 file changed

+50
-4
lines changed

1 file changed

+50
-4
lines changed

gio/src/dbus_object_manager_client.rs

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,57 @@ impl DBusObjectManagerClient {
9292
)
9393
}
9494

95-
// The checker tries to add a doc alias for `g_dbus_object_manager_client_new_finish`.
96-
// checker-ignore-item
97-
#[doc(alias = "g_dbus_object_manager_client_new")]
9895
#[allow(clippy::new_ret_no_self)]
96+
#[doc(alias = "g_dbus_object_manager_client_new")]
9997
pub fn new<P: FnOnce(Result<DBusObjectManagerClient, glib::Error>) + Send + Sync + 'static>(
98+
connection: &DBusConnection,
99+
flags: DBusObjectManagerClientFlags,
100+
name: &str,
101+
object_path: &str,
102+
cancellable: Option<&impl IsA<Cancellable>>,
103+
callback: P,
104+
) {
105+
Self::new_impl(
106+
connection,
107+
flags,
108+
name,
109+
object_path,
110+
None,
111+
cancellable,
112+
callback,
113+
)
114+
}
115+
116+
#[allow(clippy::new_ret_no_self)]
117+
#[doc(alias = "g_dbus_object_manager_client_new")]
118+
pub fn new_with_fn<
119+
P: FnOnce(Result<DBusObjectManagerClient, glib::Error>) + Send + Sync + 'static,
120+
F: Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
121+
+ Send
122+
+ Sync
123+
+ 'static,
124+
>(
125+
connection: &DBusConnection,
126+
flags: DBusObjectManagerClientFlags,
127+
name: &str,
128+
object_path: &str,
129+
get_proxy_type_func: F,
130+
cancellable: Option<&impl IsA<Cancellable>>,
131+
callback: P,
132+
) {
133+
Self::new_impl(
134+
connection,
135+
flags,
136+
name,
137+
object_path,
138+
Some(Box::new(get_proxy_type_func)),
139+
cancellable,
140+
callback,
141+
)
142+
}
143+
144+
#[allow(clippy::new_ret_no_self)]
145+
fn new_impl<P: FnOnce(Result<DBusObjectManagerClient, glib::Error>) + Send + Sync + 'static>(
100146
connection: &DBusConnection,
101147
flags: DBusObjectManagerClientFlags,
102148
name: &str,
@@ -234,7 +280,7 @@ impl DBusObjectManagerClient {
234280
let name = String::from(name);
235281
let object_path = String::from(object_path);
236282
Box::pin(GioFuture::new(&(), move |_obj, cancellable, send| {
237-
Self::new(
283+
Self::new_impl(
238284
&connection,
239285
flags,
240286
&name,

0 commit comments

Comments
 (0)