// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/iface.LoadableIcon.html).
pub type LoadableIcon
///|
pub(open) trait ILoadableIcon {
fn as_loadable_icon(Self) -> LoadableIcon
fn load(Self, Int, &ICancellable?) -> (InputStream, String) raise @glib.Error_ = _
fn load_finish(Self, &IAsyncResult) -> (InputStream, String) raise @glib.Error_ = _
}
///|
pub impl ILoadableIcon for LoadableIcon with fn as_loadable_icon(self) {
self
}
///|
#borrow(self_, type_, cancellable, error)
extern "c" fn moonbit_g_loadable_icon_load(
self_ : LoadableIcon,
size : Int,
type_ : Ref[@glib.Nullable[Bytes]],
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> InputStream = "moonbit_g_loadable_icon_load"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.LoadableIcon.load.html).
pub fn LoadableIcon::load(
self : LoadableIcon,
size : Int,
cancellable : &ICancellable?,
) -> (InputStream, String) raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let type_ : Ref[@glib.Nullable[Bytes]] = Ref(@glib.Nullable::null())
let result = moonbit_g_loadable_icon_load(
self,
size,
type_,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
(
result,
match type_.val.to_option() {
Some(bytes) => @encoding/utf8.decode_lossy(bytes)
None => ""
},
)
}
///|
#borrow(self_, res, type_, error)
extern "c" fn moonbit_g_loadable_icon_load_finish(
self_ : LoadableIcon,
res : AsyncResult,
type_ : Ref[@glib.Nullable[Bytes]],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> InputStream = "moonbit_g_loadable_icon_load_finish"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.LoadableIcon.load_finish.html).
pub fn LoadableIcon::load_finish(
self : LoadableIcon,
res : &IAsyncResult,
) -> (InputStream, String) raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let type_ : Ref[@glib.Nullable[Bytes]] = Ref(@glib.Nullable::null())
let result = moonbit_g_loadable_icon_load_finish(
self,
res.as_async_result(),
type_,
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
(
result,
match type_.val.to_option() {
Some(bytes) => @encoding/utf8.decode_lossy(bytes)
None => ""
},
)
}
///|
impl ILoadableIcon with fn load(self, size, cancellable) -> (
InputStream,
String,
) raise @glib.Error_ {
self.as_loadable_icon().load(size, cancellable)
}
///|
impl ILoadableIcon with fn load_finish(self, res) -> (InputStream, String) raise @glib.Error_ {
self.as_loadable_icon().load_finish(res)
}
///|
pub fn LoadableIcon::as_icon(self : LoadableIcon) -> Icon = "%identity"
///|
pub impl IIcon for LoadableIcon with fn as_icon(self) {
self.as_icon()
}