1use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 #[doc(alias = "GAsyncResult")]
10 pub struct AsyncResult(Interface<ffi::GAsyncResult, ffi::GAsyncResultIface>);
11
12 match fn {
13 type_ => || ffi::g_async_result_get_type(),
14 }
15}
16
17impl AsyncResult {
18 pub const NONE: Option<&'static AsyncResult> = None;
19}
20
21pub trait AsyncResultExt: IsA<AsyncResult> + 'static {
22 #[doc(alias = "g_async_result_get_source_object")]
23 #[doc(alias = "get_source_object")]
24 fn source_object(&self) -> Option<glib::Object> {
25 unsafe {
26 from_glib_full(ffi::g_async_result_get_source_object(
27 self.as_ref().to_glib_none().0,
28 ))
29 }
30 }
31
32 #[doc(alias = "g_async_result_legacy_propagate_error")]
44 fn legacy_propagate_error(&self) -> Result<(), glib::Error> {
45 unsafe {
46 let mut error = std::ptr::null_mut();
47 let is_ok = ffi::g_async_result_legacy_propagate_error(
48 self.as_ref().to_glib_none().0,
49 &mut error,
50 );
51 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
52 if error.is_null() {
53 Ok(())
54 } else {
55 Err(from_glib_full(error))
56 }
57 }
58 }
59}
60
61impl<O: IsA<AsyncResult>> AsyncResultExt for O {}