// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.IOStream.html).
pub type IOStream
///|
pub(open) trait IIOStream {
fn as_io_stream(Self) -> IOStream
fn clear_pending(Self) -> Unit = _
fn close(Self, &ICancellable?) -> Bool raise @glib.Error_ = _
fn get_input_stream(Self) -> InputStream = _
fn get_output_stream(Self) -> OutputStream = _
fn has_pending(Self) -> Bool = _
fn is_closed(Self) -> Bool = _
fn set_pending(Self) -> Bool raise @glib.Error_ = _
fn close_async(
Self,
Int,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
}
///|
pub impl IIOStream for IOStream with fn as_io_stream(self) {
self
}
///|
#borrow(result, error)
extern "c" fn moonbit_g_io_stream_splice_finish(
result : AsyncResult,
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_io_stream_splice_finish"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/type_func.IOStream.splice_finish.html).
pub fn IOStream::splice_finish(
result : &IAsyncResult,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_io_stream_splice_finish(
result.as_async_result(),
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => result
}
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.IOStream.clear_pending.html).
#borrow(self)
pub extern "c" fn IOStream::clear_pending(self : IOStream) = "moonbit_g_io_stream_clear_pending"
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_io_stream_close(
self_ : IOStream,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_io_stream_close"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.IOStream.close.html).
pub fn IOStream::close(
self : IOStream,
cancellable : &ICancellable?,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_io_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.IOStream.get_input_stream.html).
#borrow(self)
pub extern "c" fn IOStream::get_input_stream(self : IOStream) -> InputStream = "moonbit_g_io_stream_get_input_stream"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.IOStream.get_output_stream.html).
#borrow(self)
pub extern "c" fn IOStream::get_output_stream(self : IOStream) -> OutputStream = "moonbit_g_io_stream_get_output_stream"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.IOStream.has_pending.html).
#borrow(self)
pub extern "c" fn IOStream::has_pending(self : IOStream) -> Bool = "moonbit_g_io_stream_has_pending"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.IOStream.is_closed.html).
#borrow(self)
pub extern "c" fn IOStream::is_closed(self : IOStream) -> Bool = "moonbit_g_io_stream_is_closed"
///|
#borrow(self_, error)
extern "c" fn moonbit_g_io_stream_set_pending(
self_ : IOStream,
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_io_stream_set_pending"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.IOStream.set_pending.html).
pub fn IOStream::set_pending(self : IOStream) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_io_stream_set_pending(self, error_)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, cancellable)
extern "c" fn g_io_stream_close_async(
self_ : IOStream,
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_io_stream_close_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.IOStream.close_async.html).
pub fn IOStream::close_async(
self : IOStream,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_io_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))
}
},
)
}
///|
impl IIOStream with fn clear_pending(self) -> Unit {
self.as_io_stream().clear_pending()
}
///|
impl IIOStream with fn close(self, cancellable) -> Bool raise @glib.Error_ {
self.as_io_stream().close(cancellable)
}
///|
impl IIOStream with fn get_input_stream(self) -> InputStream {
self.as_io_stream().get_input_stream()
}
///|
impl IIOStream with fn get_output_stream(self) -> OutputStream {
self.as_io_stream().get_output_stream()
}
///|
impl IIOStream with fn has_pending(self) -> Bool {
self.as_io_stream().has_pending()
}
///|
impl IIOStream with fn is_closed(self) -> Bool {
self.as_io_stream().is_closed()
}
///|
impl IIOStream with fn set_pending(self) -> Bool raise @glib.Error_ {
self.as_io_stream().set_pending()
}
///|
impl IIOStream with fn close_async(self, io_priority, cancellable, callback) -> Unit {
self.as_io_stream().close_async(io_priority, cancellable, callback)
}
///|
pub fn IOStream::as_gobject_object(self : IOStream) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for IOStream with fn as_object(self) {
self.as_gobject_object()
}