// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IConverter {
  fn as_converter(Self) -> Converter
  fn convert_bytes(Self, Bytes) -> Bytes raise @glib.Error_ = _
  fn reset(Self) -> Unit = _
}

///|
pub impl IConverter for Converter with fn as_converter(self) {
  self
}

///|
/// Implementation contract for Converter.reset. Self is the retained MoonBit state; the second parameter is the invoked Converter object.
pub(open) trait VConverterReset {
  fn reset(Self, Converter) -> Unit
}

///|
#borrow(self_, bytes, error)
extern "c" fn moonbit_g_converter_convert_bytes(
  self_ : Converter,
  bytes : Bytes,
  error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bytes = "moonbit_g_converter_convert_bytes"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Converter.reset.html).
#borrow(self)
pub extern "c" fn Converter::reset(self : Converter) = "moonbit_g_converter_reset"

///|
impl IConverter with fn convert_bytes(self, bytes) -> Bytes raise @glib.Error_ {
  self.as_converter().convert_bytes(bytes)
}

///|
impl IConverter with fn reset(self) -> Unit {
  self.as_converter().reset()
}