// GENERATED — DO NOT EDIT

///|
#borrow(context, text, attrs, cached_iter, result)
extern "c" fn moonbit_pango_itemize(
  context : Context,
  text : Bytes,
  start_index : Int,
  length : Int,
  attrs : AttrList,
  cached_iter : @glib.Nullable[AttrIterator],
  result : Ref[FixedArray[Item]],
) = "moonbit_pango_itemize"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/func.itemize.html).
pub fn itemize(
  context : &IContext,
  text : String,
  start_index : Int,
  length : Int,
  attrs : AttrList,
  cached_iter : AttrIterator?,
) -> Array[Item] {
  let result_ref : Ref[FixedArray[Item]] = Ref([])
  moonbit_pango_itemize(
    context.as_context(),
    @encoding/utf8.encode(text),
    start_index,
    length,
    attrs,
    match cached_iter {
      Some(v) => @glib.Nullable::some(v)
      None => @glib.Nullable::null()
    },
    result_ref,
  )
  let values : Array[Item] = Array::new(capacity=result_ref.val.length())
  for value in result_ref.val {
    values.push(value)
  }
  values
}