// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.FileInputStream.html).
pub type FileInputStream
///|
pub(open) trait IFileInputStream {
fn as_file_input_stream(Self) -> FileInputStream
fn query_info(Self, String, &ICancellable?) -> FileInfo raise @glib.Error_ = _
fn query_info_async(
Self,
String,
Int,
&ICancellable?,
(Result[FileInfo, @glib.Error_]) -> Unit,
) -> Unit = _
}
///|
pub impl IFileInputStream for FileInputStream with fn as_file_input_stream(self) {
self
}
///|
#borrow(self_, attributes, cancellable, error)
extern "c" fn moonbit_g_file_input_stream_query_info(
self_ : FileInputStream,
attributes : Bytes,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> FileInfo = "moonbit_g_file_input_stream_query_info"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileInputStream.query_info.html).
pub fn FileInputStream::query_info(
self : FileInputStream,
attributes : String,
cancellable : &ICancellable?,
) -> FileInfo raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_file_input_stream_query_info(
self,
@encoding/utf8.encode(attributes),
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
}
///|
#borrow(self_, attributes, cancellable)
extern "c" fn g_file_input_stream_query_info_async(
self_ : FileInputStream,
attributes : Bytes,
io_priority : Int,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
@glib.Nullable[FileInfo],
@glib.Nullable[@glib.Error_],
(@glib.Nullable[FileInfo], @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (@glib.Nullable[FileInfo], @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_file_input_stream_query_info_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileInputStream.query_info_async.html).
pub fn FileInputStream::query_info_async(
self : FileInputStream,
attributes : String,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[FileInfo, @glib.Error_]) -> Unit,
) -> Unit {
g_file_input_stream_query_info_async(
self,
@encoding/utf8.encode(attributes),
io_priority,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None =>
match result.to_option() {
Some(v) => callback(Ok(v))
None => ()
}
}
},
)
}
///|
impl IFileInputStream with fn query_info(self, attributes, cancellable) -> FileInfo raise @glib.Error_ {
self.as_file_input_stream().query_info(attributes, cancellable)
}
///|
impl IFileInputStream with fn query_info_async(
self,
attributes,
io_priority,
cancellable,
callback,
) -> Unit {
self
.as_file_input_stream()
.query_info_async(attributes, io_priority, cancellable, callback)
}
///|
pub fn FileInputStream::as_input_stream(self : FileInputStream) -> InputStream = "%identity"
///|
pub impl IInputStream for FileInputStream with fn as_input_stream(self) {
self.as_input_stream()
}
///|
pub fn FileInputStream::as_gobject_object(
self : FileInputStream,
) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for FileInputStream with fn as_object(self) {
self.as_gobject_object()
}
///|
pub fn FileInputStream::as_seekable(self : FileInputStream) -> Seekable = "%identity"
///|
pub impl ISeekable for FileInputStream with fn as_seekable(self) {
self.as_seekable()
}