// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.FileIOStream.html).
pub type FileIOStream
///|
pub(open) trait IFileIOStream {
fn as_file_io_stream(Self) -> FileIOStream
fn get_etag(Self) -> String? = _
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 IFileIOStream for FileIOStream with fn as_file_io_stream(self) {
self
}
///|
#borrow(self_)
extern "c" fn moonbit_g_file_io_stream_get_etag(
self_ : FileIOStream,
) -> @glib.Nullable[Bytes] = "moonbit_g_file_io_stream_get_etag"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileIOStream.get_etag.html).
pub fn FileIOStream::get_etag(self : FileIOStream) -> String? {
let result = moonbit_g_file_io_stream_get_etag(self)
match result.to_option() {
Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
None => None
}
}
///|
#borrow(self_, attributes, cancellable, error)
extern "c" fn moonbit_g_file_io_stream_query_info(
self_ : FileIOStream,
attributes : Bytes,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> FileInfo = "moonbit_g_file_io_stream_query_info"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileIOStream.query_info.html).
pub fn FileIOStream::query_info(
self : FileIOStream,
attributes : String,
cancellable : &ICancellable?,
) -> FileInfo raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_file_io_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_io_stream_query_info_async(
self_ : FileIOStream,
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_io_stream_query_info_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileIOStream.query_info_async.html).
pub fn FileIOStream::query_info_async(
self : FileIOStream,
attributes : String,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[FileInfo, @glib.Error_]) -> Unit,
) -> Unit {
g_file_io_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 IFileIOStream with fn get_etag(self) -> String? {
self.as_file_io_stream().get_etag()
}
///|
impl IFileIOStream with fn query_info(self, attributes, cancellable) -> FileInfo raise @glib.Error_ {
self.as_file_io_stream().query_info(attributes, cancellable)
}
///|
impl IFileIOStream with fn query_info_async(
self,
attributes,
io_priority,
cancellable,
callback,
) -> Unit {
self
.as_file_io_stream()
.query_info_async(attributes, io_priority, cancellable, callback)
}
///|
pub fn FileIOStream::as_io_stream(self : FileIOStream) -> IOStream = "%identity"
///|
pub impl IIOStream for FileIOStream with fn as_io_stream(self) {
self.as_io_stream()
}
///|
pub fn FileIOStream::as_gobject_object(self : FileIOStream) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for FileIOStream with fn as_object(self) {
self.as_gobject_object()
}
///|
pub fn FileIOStream::as_seekable(self : FileIOStream) -> Seekable = "%identity"
///|
pub impl ISeekable for FileIOStream with fn as_seekable(self) {
self.as_seekable()
}