// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/iface.Icon.html).
pub type Icon
///|
pub(open) trait IIcon {
fn as_icon(Self) -> Icon
fn equal(Self, &IIcon?) -> Bool = _
fn hash(Self) -> UInt = _
fn serialize(Self) -> @glib.Variant? = _
fn to_string(Self) -> String? = _
}
///|
pub impl IIcon for Icon with fn as_icon(self) {
self
}
///|
#borrow(value)
extern "c" fn moonbit_g_icon_deserialize(
value : @glib.Variant,
) -> @glib.Nullable[Icon] = "moonbit_g_icon_deserialize"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/type_func.Icon.deserialize.html).
pub fn Icon::deserialize(value : &@glib.IVariant) -> Icon? {
let raw_result = moonbit_g_icon_deserialize(value.as_variant())
raw_result.to_option()
}
///|
#borrow(str, error)
extern "c" fn moonbit_g_icon_new_for_string(
str : Bytes,
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Icon = "moonbit_g_icon_new_for_string"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/type_func.Icon.new_for_string.html).
pub fn Icon::new_for_string(str : String) -> Icon raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_icon_new_for_string(@encoding/utf8.encode(str), error_)
match error_.val.to_option() {
Some(e) => raise e
None => result
}
}
///|
#borrow(self_, icon2)
extern "c" fn moonbit_g_icon_equal(
self_ : Icon,
icon2 : @glib.Nullable[Icon],
) -> Bool = "moonbit_g_icon_equal"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Icon.equal.html).
pub fn Icon::equal(self : Icon, icon2 : &IIcon?) -> Bool {
moonbit_g_icon_equal(
self,
match icon2 {
Some(v) => @glib.Nullable::some(v.as_icon())
None => @glib.Nullable::null()
},
)
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Icon.hash.html).
#borrow(self)
pub extern "c" fn Icon::hash(self : Icon) -> UInt = "moonbit_g_icon_hash"
///|
#borrow(self_)
extern "c" fn moonbit_g_icon_serialize(
self_ : Icon,
) -> @glib.Nullable[@glib.Variant] = "moonbit_g_icon_serialize"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Icon.serialize.html).
pub fn Icon::serialize(self : Icon) -> @glib.Variant? {
let raw_result = moonbit_g_icon_serialize(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_icon_to_string(self_ : Icon) -> @glib.Nullable[Bytes] = "moonbit_g_icon_to_string"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Icon.to_string.html).
pub fn Icon::to_string(self : Icon) -> String? {
let result = moonbit_g_icon_to_string(self)
match result.to_option() {
Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
None => None
}
}
///|
impl IIcon with fn equal(self, icon2) -> Bool {
self.as_icon().equal(icon2)
}
///|
impl IIcon with fn hash(self) -> UInt {
self.as_icon().hash()
}
///|
impl IIcon with fn serialize(self) -> @glib.Variant? {
self.as_icon().serialize()
}
///|
impl IIcon with fn to_string(self) -> String? {
self.as_icon().to_string()
}