Trait gio::prelude::FileEnumeratorExt[][src]

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 child(&self, info: &FileInfo) -> File;
fn container(&self) -> 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); }
Expand description

Trait containing all FileEnumerator methods.

Implementors

FileEnumerator

Required methods

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.

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 g_file_enumerator_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

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 next_file().

This is a convenience method that’s equivalent to:

⚠️ The following code is in C ⚠️

  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 next_file() or the async equivalents.

Returns

a File for the FileInfo passed it.

Get the File container which is being enumerated.

Returns

the File which is being enumerated.

Checks if the file enumerator has pending operations.

Returns

true if the self has pending operations.

Checks if the file enumerator has been closed.

Returns

true if the self is closed.

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 g_object_unref() when no longer needed.

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

Sets the file enumerator as having pending operations.

pending

a boolean value.

Implementors