[][src]Trait gio::SeekableExt

pub trait SeekableExt: 'static {
    fn can_seek(&self) -> bool;
fn can_truncate(&self) -> bool;
fn seek<P: IsA<Cancellable>>(
        &self,
        offset: i64,
        type_: SeekType,
        cancellable: Option<&P>
    ) -> Result<(), Error>;
fn tell(&self) -> i64;
fn truncate<P: IsA<Cancellable>>(
        &self,
        offset: i64,
        cancellable: Option<&P>
    ) -> Result<(), Error>; }

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>

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

Tells the current position within the stream.

Returns

the offset from the beginning of the buffer.

fn truncate<P: IsA<Cancellable>>(
    &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.

Loading content...

Implementors

impl<O: IsA<Seekable>> SeekableExt for O[src]

Loading content...