// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.InputStream.html).
pub type InputStream
///|
pub(open) trait IInputStream {
fn as_input_stream(Self) -> InputStream
fn clear_pending(Self) -> Unit = _
fn close(Self, &ICancellable?) -> Bool raise @glib.Error_ = _
fn has_pending(Self) -> Bool = _
fn is_closed(Self) -> Bool = _
fn read_all_finish(Self, &IAsyncResult) -> (Bool, UInt64) raise @glib.Error_ = _
fn read_bytes(Self, UInt64, &ICancellable?) -> Bytes raise @glib.Error_ = _
fn read_finish(Self, &IAsyncResult) -> Int64 raise @glib.Error_ = _
fn set_pending(Self) -> Bool raise @glib.Error_ = _
fn skip(Self, UInt64, &ICancellable?) -> Int64 raise @glib.Error_ = _
fn close_async(
Self,
Int,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
fn read_bytes_async(
Self,
UInt64,
Int,
&ICancellable?,
(Result[Bytes, @glib.Error_]) -> Unit,
) -> Unit = _
fn skip_async(
Self,
UInt64,
Int,
&ICancellable?,
(Result[Int64, @glib.Error_]) -> Unit,
) -> Unit = _
}
///|
pub impl IInputStream for InputStream with fn as_input_stream(self) {
self
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.clear_pending.html).
#borrow(self)
pub extern "c" fn InputStream::clear_pending(self : InputStream) = "moonbit_g_input_stream_clear_pending"
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_input_stream_close(
self_ : InputStream,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_input_stream_close"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.close.html).
pub fn InputStream::close(
self : InputStream,
cancellable : &ICancellable?,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_input_stream_close(
self,
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
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.has_pending.html).
#borrow(self)
pub extern "c" fn InputStream::has_pending(self : InputStream) -> Bool = "moonbit_g_input_stream_has_pending"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.is_closed.html).
#borrow(self)
pub extern "c" fn InputStream::is_closed(self : InputStream) -> Bool = "moonbit_g_input_stream_is_closed"
///|
#borrow(self_, result, bytes_read, error)
extern "c" fn moonbit_g_input_stream_read_all_finish(
self_ : InputStream,
result : AsyncResult,
bytes_read : Ref[UInt64],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_input_stream_read_all_finish"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.read_all_finish.html).
pub fn InputStream::read_all_finish(
self : InputStream,
result : &IAsyncResult,
) -> (Bool, UInt64) raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let bytes_read = Ref(0UL)
let result = moonbit_g_input_stream_read_all_finish(
self,
result.as_async_result(),
bytes_read,
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
(result, bytes_read.val)
}
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_input_stream_read_bytes(
self_ : InputStream,
count : UInt64,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bytes = "moonbit_g_input_stream_read_bytes"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.read_bytes.html).
pub fn InputStream::read_bytes(
self : InputStream,
count : UInt64,
cancellable : &ICancellable?,
) -> Bytes raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_input_stream_read_bytes(
self,
count,
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_, result, error)
extern "c" fn moonbit_g_input_stream_read_finish(
self_ : InputStream,
result : AsyncResult,
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Int64 = "moonbit_g_input_stream_read_finish"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.read_finish.html).
pub fn InputStream::read_finish(
self : InputStream,
result : &IAsyncResult,
) -> Int64 raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_input_stream_read_finish(
self,
result.as_async_result(),
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, error)
extern "c" fn moonbit_g_input_stream_set_pending(
self_ : InputStream,
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_input_stream_set_pending"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.set_pending.html).
pub fn InputStream::set_pending(self : InputStream) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_input_stream_set_pending(self, error_)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_input_stream_skip(
self_ : InputStream,
count : UInt64,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Int64 = "moonbit_g_input_stream_skip"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.skip.html).
pub fn InputStream::skip(
self : InputStream,
count : UInt64,
cancellable : &ICancellable?,
) -> Int64 raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_input_stream_skip(
self,
count,
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_, cancellable)
extern "c" fn g_input_stream_close_async(
self_ : InputStream,
io_priority : Int,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
Bool,
@glib.Nullable[@glib.Error_],
(Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_input_stream_close_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.close_async.html).
pub fn InputStream::close_async(
self : InputStream,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_input_stream_close_async(
self,
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 => callback(Ok(result))
}
},
)
}
///|
#borrow(self_, cancellable)
extern "c" fn g_input_stream_read_bytes_async(
self_ : InputStream,
count : UInt64,
io_priority : Int,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
Bytes,
@glib.Nullable[@glib.Error_],
(Bytes, @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (Bytes, @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_input_stream_read_bytes_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.read_bytes_async.html).
pub fn InputStream::read_bytes_async(
self : InputStream,
count : UInt64,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[Bytes, @glib.Error_]) -> Unit,
) -> Unit {
g_input_stream_read_bytes_async(
self,
count,
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 => callback(Ok(result))
}
},
)
}
///|
#borrow(self_, cancellable)
extern "c" fn g_input_stream_skip_async(
self_ : InputStream,
count : UInt64,
io_priority : Int,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
Int64,
@glib.Nullable[@glib.Error_],
(Int64, @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (Int64, @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_input_stream_skip_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.InputStream.skip_async.html).
pub fn InputStream::skip_async(
self : InputStream,
count : UInt64,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[Int64, @glib.Error_]) -> Unit,
) -> Unit {
g_input_stream_skip_async(
self,
count,
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 => callback(Ok(result))
}
},
)
}
///|
impl IInputStream with fn clear_pending(self) -> Unit {
self.as_input_stream().clear_pending()
}
///|
impl IInputStream with fn close(self, cancellable) -> Bool raise @glib.Error_ {
self.as_input_stream().close(cancellable)
}
///|
impl IInputStream with fn has_pending(self) -> Bool {
self.as_input_stream().has_pending()
}
///|
impl IInputStream with fn is_closed(self) -> Bool {
self.as_input_stream().is_closed()
}
///|
impl IInputStream with fn read_all_finish(self, result) -> (Bool, UInt64) raise @glib.Error_ {
self.as_input_stream().read_all_finish(result)
}
///|
impl IInputStream with fn read_bytes(self, count, cancellable) -> Bytes raise @glib.Error_ {
self.as_input_stream().read_bytes(count, cancellable)
}
///|
impl IInputStream with fn read_finish(self, result) -> Int64 raise @glib.Error_ {
self.as_input_stream().read_finish(result)
}
///|
impl IInputStream with fn set_pending(self) -> Bool raise @glib.Error_ {
self.as_input_stream().set_pending()
}
///|
impl IInputStream with fn skip(self, count, cancellable) -> Int64 raise @glib.Error_ {
self.as_input_stream().skip(count, cancellable)
}
///|
impl IInputStream with fn close_async(self, io_priority, cancellable, callback) -> Unit {
self.as_input_stream().close_async(io_priority, cancellable, callback)
}
///|
impl IInputStream with fn read_bytes_async(
self,
count,
io_priority,
cancellable,
callback,
) -> Unit {
self
.as_input_stream()
.read_bytes_async(count, io_priority, cancellable, callback)
}
///|
impl IInputStream with fn skip_async(
self,
count,
io_priority,
cancellable,
callback,
) -> Unit {
self.as_input_stream().skip_async(count, io_priority, cancellable, callback)
}
///|
pub fn InputStream::as_gobject_object(self : InputStream) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for InputStream with fn as_object(self) {
self.as_gobject_object()
}