[][src]Trait gio::FileEnumeratorExt

pub trait FileEnumeratorExt: 'static {
    fn close<P: IsA<Cancellable>>(
        &self,
        cancellable: Option<&P>
    ) -> Result<(), Error>;
fn close_async<P: IsA<Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        io_priority: Priority,
        cancellable: Option<&P>,
        callback: Q
    );
fn close_async_future(
        &self,
        io_priority: Priority
    ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn get_child(&self, info: &FileInfo) -> Option<File>;
fn get_container(&self) -> Option<File>;
fn has_pending(&self) -> bool;
fn is_closed(&self) -> bool;
fn next_file<P: IsA<Cancellable>>(
        &self,
        cancellable: Option<&P>
    ) -> Result<Option<FileInfo>, Error>;
fn next_files_async<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<FileInfo>, Error>) + Send + 'static>(
        &self,
        num_files: i32,
        io_priority: Priority,
        cancellable: Option<&P>,
        callback: Q
    );
fn next_files_async_future(
        &self,
        num_files: i32,
        io_priority: Priority
    ) -> Pin<Box_<dyn Future<Output = Result<Vec<FileInfo>, Error>> + 'static>>;
fn set_pending(&self, pending: bool); }

Trait containing all FileEnumerator methods.

Implementors

FileEnumerator

Required methods

fn close<P: IsA<Cancellable>>(
    &self,
    cancellable: Option<&P>
) -> Result<(), Error>

Releases all resources used by this enumerator, making the enumerator return IOErrorEnum::Closed on all calls.

This will be automatically called when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.

cancellable

optional Cancellable object, None to ignore.

Returns

true on success or false on error.

fn close_async<P: IsA<Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(
    &self,
    io_priority: Priority,
    cancellable: Option<&P>,
    callback: Q
)

Asynchronously closes the file enumerator.

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 in FileEnumeratorExt::close_finish.

io_priority

the [I/O priority][io-priority] of the request

cancellable

optional Cancellable object, None to ignore.

callback

a GAsyncReadyCallback to call when the request is satisfied

user_data

the data to pass to callback function

fn close_async_future(
    &self,
    io_priority: Priority
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

fn get_child(&self, info: &FileInfo) -> Option<File>

Return a new File which refers to the file named by info in the source directory of self. This function is primarily intended to be used inside loops with FileEnumeratorExt::next_file.

This is a convenience method that's equivalent to:

  gchar *name = g_file_info_get_name (info);
  GFile *child = g_file_get_child (g_file_enumerator_get_container (enumr),
                                   name);

info

a FileInfo gotten from FileEnumeratorExt::next_file or the async equivalents.

Returns

a File for the FileInfo passed it.

fn get_container(&self) -> Option<File>

Get the File container which is being enumerated.

Returns

the File which is being enumerated.

fn has_pending(&self) -> bool

Checks if the file enumerator has pending operations.

Returns

true if the self has pending operations.

fn is_closed(&self) -> bool

Checks if the file enumerator has been closed.

Returns

true if the self is closed.

fn next_file<P: IsA<Cancellable>>(
    &self,
    cancellable: Option<&P>
) -> Result<Option<FileInfo>, Error>

Returns information for the next file in the enumerated object. Will block until the information is available. The FileInfo returned from this function will contain attributes that match the attribute string that was passed when the FileEnumerator was created.

See the documentation of FileEnumerator for information about the order of returned files.

On error, returns None and sets error to the error. If the enumerator is at the end, None will be returned and error will be unset.

cancellable

optional Cancellable object, None to ignore.

Returns

A FileInfo or None on error or end of enumerator. Free the returned object with gobject::ObjectExt::unref when no longer needed.

fn next_files_async<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<FileInfo>, Error>) + Send + 'static>(
    &self,
    num_files: i32,
    io_priority: Priority,
    cancellable: Option<&P>,
    callback: Q
)

Request information for a number of files from the enumerator asynchronously. When all i/o for the operation is finished the callback will be called with the requested information.

See the documentation of FileEnumerator for information about the order of returned files.

The callback can be called with less than num_files files in case of error or at the end of the enumerator. In case of a partial error the callback will be called with any succeeding items and no error, and on the next request the error will be reported. If a request is cancelled the callback will be called with IOErrorEnum::Cancelled.

During an async request no other sync and async calls are allowed, and will result in IOErrorEnum::Pending errors.

Any outstanding i/o request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is G_PRIORITY_DEFAULT.

num_files

the number of file info objects to request

io_priority

the [I/O priority][io-priority] of the request

cancellable

optional Cancellable object, None to ignore.

callback

a GAsyncReadyCallback to call when the request is satisfied

user_data

the data to pass to callback function

fn next_files_async_future(
    &self,
    num_files: i32,
    io_priority: Priority
) -> Pin<Box_<dyn Future<Output = Result<Vec<FileInfo>, Error>> + 'static>>

fn set_pending(&self, pending: bool)

Sets the file enumerator as having pending operations.

pending

a boolean value.

Loading content...

Implementors

impl<O: IsA<FileEnumerator>> FileEnumeratorExt for O[src]

Loading content...