// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://docs.gtk.org/gio/iface.AsyncResult.html).
pub type AsyncResult

///|
pub(open) trait IAsyncResult {
  fn as_async_result(Self) -> AsyncResult
  fn get_source_object(Self) -> @gobject.Object? = _
  fn legacy_propagate_error(Self) -> Bool raise @glib.Error_ = _
}

///|
pub impl IAsyncResult for AsyncResult with fn as_async_result(self) {
  self
}

///|
#borrow(self_)
extern "c" fn moonbit_g_async_result_get_source_object(
  self_ : AsyncResult,
) -> @glib.Nullable[@gobject.Object] = "moonbit_g_async_result_get_source_object"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.AsyncResult.get_source_object.html).
pub fn AsyncResult::get_source_object(self : AsyncResult) -> @gobject.Object? {
  let raw_result = moonbit_g_async_result_get_source_object(self)
  raw_result.to_option()
}

///|
#borrow(self_, error)
extern "c" fn moonbit_g_async_result_legacy_propagate_error(
  self_ : AsyncResult,
  error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_async_result_legacy_propagate_error"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.AsyncResult.legacy_propagate_error.html).
pub fn AsyncResult::legacy_propagate_error(
  self : AsyncResult,
) -> Bool raise @glib.Error_ {
  let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
  let result = moonbit_g_async_result_legacy_propagate_error(self, error_)
  match error_.val.to_option() {
    Some(e) => raise e
    None => ()
  }
  result
}

///|
impl IAsyncResult with fn get_source_object(self) -> @gobject.Object? {
  self.as_async_result().get_source_object()
}

///|
impl IAsyncResult with fn legacy_propagate_error(self) -> Bool raise @glib.Error_ {
  self.as_async_result().legacy_propagate_error()
}