// GENERATED — DO NOT EDIT

///|
#borrow(markup_text, text, accel_char, error, native_result)
extern "c" fn moonbit_pango_parse_markup(
  markup_text : Bytes,
  length : Int,
  accel_marker : UInt,
  text : Ref[@glib.Nullable[Bytes]],
  accel_char : Ref[UInt],
  error : Ref[@glib.Nullable[@glib.Error_]],
  native_result : Ref[Int],
) -> AttrList = "moonbit_pango_parse_markup"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/func.parse_markup.html).
pub fn parse_markup(
  markup_text : String,
  length : Int,
  accel_marker : UInt,
) -> (AttrList, String, UInt) raise @glib.Error_ {
  let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
  let text : Ref[@glib.Nullable[Bytes]] = Ref(@glib.Nullable::null())
  let accel_char = Ref(0U)
  let native_result = Ref(0)
  let __result = moonbit_pango_parse_markup(
    @encoding/utf8.encode(markup_text),
    length,
    accel_marker,
    text,
    accel_char,
    error_,
    native_result,
  )
  match error_.val.to_option() {
    Some(e) => raise e
    None => ()
  }
  (
    __result,
    match text.val.to_option() {
      Some(bytes) => @encoding/utf8.decode_lossy(bytes)
      None => ""
    },
    accel_char.val,
  )
}