// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IInetSocketAddress {
  fn as_inet_socket_address(Self) -> InetSocketAddress
  fn get_address(Self) -> InetAddress = _
  fn get_flowinfo(Self) -> UInt = _
  fn get_port(Self) -> UInt = _
  fn get_scope_id(Self) -> UInt = _
}

///|
pub impl IInetSocketAddress for InetSocketAddress with fn as_inet_socket_address(
  self,
) {
  self
}

///|
#borrow(address)
extern "c" fn moonbit_g_inet_socket_address_new(
  address : InetAddress,
  port : UInt,
) -> InetSocketAddress = "moonbit_g_inet_socket_address_new"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.InetSocketAddress.new.html).
pub fn InetSocketAddress::new(
  address : &IInetAddress,
  port : UInt,
) -> InetSocketAddress {
  moonbit_g_inet_socket_address_new(address.as_inet_address(), port)
}

///|
#borrow(address)
extern "c" fn moonbit_g_inet_socket_address_new_from_string(
  address : Bytes,
  port : UInt,
) -> @glib.Nullable[InetSocketAddress] = "moonbit_g_inet_socket_address_new_from_string"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.InetSocketAddress.new_from_string.html).
pub fn InetSocketAddress::new_from_string(
  address : String,
  port : UInt,
) -> InetSocketAddress? {
  let raw_result = moonbit_g_inet_socket_address_new_from_string(
    @encoding/utf8.encode(address),
    port,
  )
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InetSocketAddress.get_address.html).
#borrow(self)
pub extern "c" fn InetSocketAddress::get_address(
  self : InetSocketAddress,
) -> InetAddress = "moonbit_g_inet_socket_address_get_address"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InetSocketAddress.get_flowinfo.html).
#borrow(self)
pub extern "c" fn InetSocketAddress::get_flowinfo(
  self : InetSocketAddress,
) -> UInt = "moonbit_g_inet_socket_address_get_flowinfo"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InetSocketAddress.get_port.html).
#borrow(self)
pub extern "c" fn InetSocketAddress::get_port(self : InetSocketAddress) -> UInt = "moonbit_g_inet_socket_address_get_port"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InetSocketAddress.get_scope_id.html).
#borrow(self)
pub extern "c" fn InetSocketAddress::get_scope_id(
  self : InetSocketAddress,
) -> UInt = "moonbit_g_inet_socket_address_get_scope_id"

///|
impl IInetSocketAddress with fn get_address(self) -> InetAddress {
  self.as_inet_socket_address().get_address()
}

///|
impl IInetSocketAddress with fn get_flowinfo(self) -> UInt {
  self.as_inet_socket_address().get_flowinfo()
}

///|
impl IInetSocketAddress with fn get_port(self) -> UInt {
  self.as_inet_socket_address().get_port()
}

///|
impl IInetSocketAddress with fn get_scope_id(self) -> UInt {
  self.as_inet_socket_address().get_scope_id()
}

///|
pub fn InetSocketAddress::as_socket_address(
  self : InetSocketAddress,
) -> SocketAddress = "%identity"

///|
pub impl ISocketAddress for InetSocketAddress with fn as_socket_address(self) {
  self.as_socket_address()
}

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

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

///|
pub fn InetSocketAddress::as_socket_connectable(
  self : InetSocketAddress,
) -> SocketConnectable = "%identity"

///|
pub impl ISocketConnectable for InetSocketAddress with fn as_socket_connectable(
  self,
) {
  self.as_socket_connectable()
}