[−][src]Trait gio::SeekableExt
Trait containing all Seekable
methods.
Implementors
BufferedInputStream
, BufferedOutputStream
, DataInputStream
, DataOutputStream
, FileIOStream
, FileInputStream
, FileOutputStream
, MemoryInputStream
, MemoryOutputStream
, Seekable
Required methods
fn can_seek(&self) -> bool
Tests if the stream supports the SeekableIface
.
Returns
true
if self
can be seeked. false
otherwise.
fn can_truncate(&self) -> bool
Tests if the length of the stream can be adjusted with
Seekable::truncate
.
Returns
true
if the stream can be truncated, false
otherwise.
fn seek<P: IsA<Cancellable>>(
&self,
offset: i64,
type_: SeekType,
cancellable: Option<&P>
) -> Result<(), Error>
&self,
offset: i64,
type_: SeekType,
cancellable: Option<&P>
) -> Result<(), Error>
Seeks in the stream by the given offset
, modified by type_
.
Attempting to seek past the end of the stream will have different results depending on if the stream is fixed-sized or resizable. If the stream is resizable then seeking past the end and then writing will result in zeros filling the empty space. Seeking past the end of a resizable stream and reading will result in EOF. Seeking past the end of a fixed-sized stream will fail.
Any operation that would result in a negative offset will fail.
If cancellable
is not None
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnum::Cancelled
will be returned.
offset
a goffset
.
type_
a glib::SeekType
.
cancellable
optional Cancellable
object, None
to ignore.
Returns
true
if successful. If an error
has occurred, this function will return false
and set error
appropriately if present.
fn tell(&self) -> i64
fn truncate<P: IsA<Cancellable>>(
&self,
offset: i64,
cancellable: Option<&P>
) -> Result<(), Error>
&self,
offset: i64,
cancellable: Option<&P>
) -> Result<(), Error>
Sets the length of the stream to offset
. If the stream was previously
larger than offset
, the extra data is discarded. If the stream was
previouly shorter than offset
, it is extended with NUL ('\0') bytes.
If cancellable
is not None
, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error IOErrorEnum::Cancelled
will be returned. If an
operation was partially finished when the operation was cancelled the
partial result will be returned, without an error.
offset
new length for self
, in bytes.
cancellable
optional Cancellable
object, None
to ignore.
Returns
true
if successful. If an error
has occurred, this function will return false
and set error
appropriately if present.
Implementors
impl<O: IsA<Seekable>> SeekableExt for O
[src]
fn can_seek(&self) -> bool
[src]
fn can_truncate(&self) -> bool
[src]
fn seek<P: IsA<Cancellable>>(
&self,
offset: i64,
type_: SeekType,
cancellable: Option<&P>
) -> Result<(), Error>
[src]
&self,
offset: i64,
type_: SeekType,
cancellable: Option<&P>
) -> Result<(), Error>
fn tell(&self) -> i64
[src]
fn truncate<P: IsA<Cancellable>>(
&self,
offset: i64,
cancellable: Option<&P>
) -> Result<(), Error>
[src]
&self,
offset: i64,
cancellable: Option<&P>
) -> Result<(), Error>