// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/iface.Seekable.html).
pub type Seekable
///|
pub(open) trait ISeekable {
fn as_seekable(Self) -> Seekable
fn can_seek(Self) -> Bool = _
fn can_truncate(Self) -> Bool = _
fn seek(Self, Int64, @glib.SeekType, &ICancellable?) -> Bool raise @glib.Error_ = _
fn tell(Self) -> Int64 = _
fn truncate(Self, Int64, &ICancellable?) -> Bool raise @glib.Error_ = _
}
///|
pub impl ISeekable for Seekable with fn as_seekable(self) {
self
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Seekable.can_seek.html).
#borrow(self)
pub extern "c" fn Seekable::can_seek(self : Seekable) -> Bool = "moonbit_g_seekable_can_seek"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Seekable.can_truncate.html).
#borrow(self)
pub extern "c" fn Seekable::can_truncate(self : Seekable) -> Bool = "moonbit_g_seekable_can_truncate"
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_seekable_seek(
self_ : Seekable,
offset : Int64,
type_ : @glib.SeekType,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_seekable_seek"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Seekable.seek.html).
pub fn Seekable::seek(
self : Seekable,
offset : Int64,
type_ : @glib.SeekType,
cancellable : &ICancellable?,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_seekable_seek(
self,
offset,
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
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Seekable.tell.html).
#borrow(self)
pub extern "c" fn Seekable::tell(self : Seekable) -> Int64 = "moonbit_g_seekable_tell"
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_seekable_truncate(
self_ : Seekable,
offset : Int64,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_seekable_truncate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Seekable.truncate.html).
pub fn Seekable::truncate(
self : Seekable,
offset : Int64,
cancellable : &ICancellable?,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_seekable_truncate(
self,
offset,
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
}
///|
impl ISeekable with fn can_seek(self) -> Bool {
self.as_seekable().can_seek()
}
///|
impl ISeekable with fn can_truncate(self) -> Bool {
self.as_seekable().can_truncate()
}
///|
impl ISeekable with fn seek(self, offset, type_, cancellable) -> Bool raise @glib.Error_ {
self.as_seekable().seek(offset, type_, cancellable)
}
///|
impl ISeekable with fn tell(self) -> Int64 {
self.as_seekable().tell()
}
///|
impl ISeekable with fn truncate(self, offset, cancellable) -> Bool raise @glib.Error_ {
self.as_seekable().truncate(offset, cancellable)
}