// GENERATED — DO NOT EDIT

///|
#borrow(str, weight)
extern "c" fn moonbit_pango_parse_weight(
  str : Bytes,
  weight : Ref[Weight],
  warn : Bool,
) -> Bool = "moonbit_pango_parse_weight"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/func.parse_weight.html).
pub fn parse_weight(str : String, warn : Bool) -> Weight? {
  let weight = Ref(Weight::Thin)
  let result = moonbit_pango_parse_weight(
    @encoding/utf8.encode(str),
    weight,
    warn,
  )
  if result {
    Some(weight.val)
  } else {
    None
  }
}