// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IThreadedSocketService {
  fn as_threaded_socket_service(Self) -> ThreadedSocketService
  fn connect_run(
    Self,
    (ThreadedSocketService, SocketConnection, @gobject.Object?) -> Bool,
  ) -> UInt64 = _
}

///|
pub impl IThreadedSocketService for ThreadedSocketService with fn as_threaded_socket_service(
  self,
) {
  self
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.ThreadedSocketService.new.html).
pub extern "c" fn ThreadedSocketService::new(
  max_threads : Int,
) -> ThreadedSocketService = "moonbit_g_threaded_socket_service_new"

///|
#borrow(instance)
extern "c" fn g_threaded_socket_service_connect_run(
  instance : ThreadedSocketService,
  function : FuncRef[
    (
      ThreadedSocketService,
      SocketConnection,
      @gobject.Object?,
      (ThreadedSocketService, SocketConnection, @gobject.Object?) -> Bool,
    ) -> Bool,
  ],
  closure : (ThreadedSocketService, SocketConnection, @gobject.Object?) -> Bool,
) -> UInt64 = "moonbit_g_threaded_socket_service_connect_run"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.ThreadedSocketService.run.html).
pub fn ThreadedSocketService::connect_run(
  self : ThreadedSocketService,
  f : (ThreadedSocketService, SocketConnection, @gobject.Object?) -> Bool,
) -> UInt64 {
  g_threaded_socket_service_connect_run(
    self,
    fn(instance_, connection, source_object, f) {
      f(instance_, connection, source_object)
    },
    f,
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/property.ThreadedSocketService.max-threads.html).
#borrow(self_)
pub extern "c" fn ThreadedSocketService::get_max_threads(
  self_ : ThreadedSocketService,
) -> Int = "moonbit_g_threaded_socket_service_get_max_threads"

///|
impl IThreadedSocketService with fn connect_run(self, f) -> UInt64 {
  self.as_threaded_socket_service().connect_run(f)
}

///|
pub fn ThreadedSocketService::as_socket_service(
  self : ThreadedSocketService,
) -> SocketService = "%identity"

///|
pub impl ISocketService for ThreadedSocketService with fn as_socket_service(
  self,
) {
  self.as_socket_service()
}

///|
pub fn ThreadedSocketService::as_socket_listener(
  self : ThreadedSocketService,
) -> SocketListener = "%identity"

///|
pub impl ISocketListener for ThreadedSocketService with fn as_socket_listener(
  self,
) {
  self.as_socket_listener()
}

///|
pub fn ThreadedSocketService::as_gobject_object(
  self : ThreadedSocketService,
) -> @gobject.Object = "%identity"

///|
pub impl @gobject.IObject for ThreadedSocketService with fn as_object(self) {
  self.as_gobject_object()
}