gio

Struct File

Source
pub struct File { /* private fields */ }
Expand description

GFile is a high level abstraction for manipulating files on a virtual file system. GFiles are lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that GFile objects do not represent files, merely an identifier for a file. All file content I/O is implemented as streaming operations (see InputStream and OutputStream).

To construct a GFile, you can use:

One way to think of a GFile is as an abstraction of a pathname. For normal files the system pathname is what is stored internally, but as GFiles are extensible it could also be something else that corresponds to a pathname in a userspace implementation of a filesystem.

GFiles make up hierarchies of directories and files that correspond to the files on a filesystem. You can move through the file system with GFile using FileExt::parent() to get an identifier for the parent directory, FileExt::child() to get a child within a directory, and FileExt::resolve_relative_path() to resolve a relative path between two GFiles. There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call FileExt::parent() on two different files.

All GFiles have a basename (get with FileExt::basename()). These names are byte strings that are used to identify the file on the filesystem (relative to its parent directory) and there is no guarantees that they have any particular charset encoding or even make any sense at all. If you want to use filenames in a user interface you should use the display name that you can get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with FileExt::query_info(). This is guaranteed to be in UTF-8 and can be used in a user interface. But always store the real basename or the GFile to use to actually access the file, because there is no way to go from a display name to the actual name.

Using GFile as an identifier has the same weaknesses as using a path in that there may be multiple aliases for the same file. For instance, hard or soft links may cause two different GFiles to refer to the same file. Other possible causes for aliases are: case insensitive filesystems, short and long names on FAT/NTFS, or bind mounts in Linux. If you want to check if two GFiles point to the same file you can query for the G_FILE_ATTRIBUTE_ID_FILE attribute. Note that GFile does some trivial canonicalization of pathnames passed in, so that trivial differences in the path string used at creation (duplicated slashes, slash at end of path, . or .. path segments, etc) does not create different GFiles.

Many GFile operations have both synchronous and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply have _async() appended to their function names. The asynchronous I/O functions call a callback::Gio::AsyncReadyCallback which is then used to finalize the operation, producing a [AsyncResult][crate::AsyncResult] which is then passed to the function’s matching _finish()` operation.

It is highly recommended to use asynchronous calls when running within a shared main loop, such as in the main thread of an application. This avoids I/O operations blocking other sources on the main loop from being dispatched. Synchronous I/O operations should be performed from worker threads. See the introduction to asynchronous programming section for more.

Some GFile operations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include:

§Entity Tags

One notable feature of GFiles are entity tags, or ‘etags’ for short. Entity tags are somewhat like a more abstract version of the traditional mtime, and can be used to quickly determine if the file has been modified from the version on the file system. See the HTTP 1.1 specification for HTTP ETag headers, which are a very similar concept.

§Implements

FileExt, FileExtManual

GLib type: GObject with reference counted clone semantics.

Implementations§

Source§

impl File

Source

pub fn new_tmp_async<P: FnOnce(Result<(File, FileIOStream), Error>) + 'static>( tmpl: Option<impl AsRef<Path>>, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Available on crate feature v2_74 only.

Asynchronously opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) as g_file_new_tmp().

@tmpl should be a string in the GLib file name encoding containing a sequence of six ‘X’ characters, and containing no directory components. If it is None, a default template is used.

§tmpl

Template for the file name, as in g_file_open_tmp(), or None for a default template

§io_priority

the I/O priority of the request

§cancellable

optional #GCancellable object, None to ignore

§callback

a #GAsyncReadyCallback to call when the request is done

Source

pub fn new_tmp_future( tmpl: Option<impl AsRef<Path>>, io_priority: Priority, ) -> Pin<Box<dyn Future<Output = Result<(File, FileIOStream), Error>> + 'static>>

Available on crate feature v2_74 only.
Source

pub fn new_tmp_dir_async<P: FnOnce(Result<File, Error>) + 'static>( tmpl: Option<impl AsRef<Path>>, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Available on crate feature v2_74 only.

Asynchronously creates a directory in the preferred directory for temporary files (as returned by g_get_tmp_dir()) as g_dir_make_tmp().

@tmpl should be a string in the GLib file name encoding containing a sequence of six ‘X’ characters, and containing no directory components. If it is None, a default template is used.

§tmpl

Template for the file name, as in g_dir_make_tmp(), or None for a default template

§io_priority

the I/O priority of the request

§cancellable

optional #GCancellable object, None to ignore

§callback

a #GAsyncReadyCallback to call when the request is done

Source

pub fn new_tmp_dir_future( tmpl: Option<impl AsRef<Path>>, io_priority: Priority, ) -> Pin<Box<dyn Future<Output = Result<File, Error>> + 'static>>

Available on crate feature v2_74 only.
Source§

impl File

Source

pub const NONE: Option<&'static File> = None

Source

pub fn new_build_filenamev(args: &[&Path]) -> File

Available on crate feature v2_78 only.

Constructs a #GFile from a vector of elements using the correct separator for filenames.

Using this function is equivalent to calling g_build_filenamev(), followed by g_file_new_for_path() on the result.

§args

None-terminated array of strings containing the path elements.

§Returns

a new #GFile

Source

pub fn for_commandline_arg(arg: impl AsRef<OsStr>) -> File

Creates a #GFile with the given argument from the command line. The value of @arg can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if @arg points to a malformed path.

Note that on Windows, this function expects its argument to be in UTF-8 – not the system code page. This means that you should not use this function with string from argv as it is passed to main(). g_win32_get_command_line() will return a UTF-8 version of the commandline. #GApplication also uses UTF-8 but g_application_command_line_create_file_for_arg() may be more useful for you there. It is also always possible to use this function with #GOptionContext arguments of type glib::OptionArg::Filename.

§arg

a command line string

§Returns

a new #GFile. Free the returned object with g_object_unref().

Source

pub fn for_commandline_arg_and_cwd( arg: impl AsRef<OsStr>, cwd: impl AsRef<Path>, ) -> File

Creates a #GFile with the given argument from the command line.

This function is similar to g_file_new_for_commandline_arg() except that it allows for passing the current working directory as an argument instead of using the current working directory of the process.

This is useful if the commandline argument was given in a context other than the invocation of the current process.

See also g_application_command_line_create_file_for_arg().

§arg

a command line string

§cwd

the current working directory of the commandline

§Returns

a new #GFile

Source

pub fn for_path(path: impl AsRef<Path>) -> File

Constructs a #GFile for a given path. This operation never fails, but the returned object might not support any I/O operation if @path is malformed.

§path

a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.

§Returns

a new #GFile for the given @path. Free the returned object with g_object_unref().

Source

pub fn for_uri(uri: &str) -> File

Constructs a #GFile for a given URI. This operation never fails, but the returned object might not support any I/O operation if @uri is malformed or if the uri type is not supported.

§uri

a UTF-8 string containing a URI

§Returns

a new #GFile for the given @uri. Free the returned object with g_object_unref().

Source

pub fn new_tmp( tmpl: Option<impl AsRef<Path>>, ) -> Result<(File, FileIOStream), Error>

Opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) and returns a #GFile and #GFileIOStream pointing to it.

@tmpl should be a string in the GLib file name encoding containing a sequence of six ‘X’ characters, and containing no directory components. If it is None, a default template is used.

Unlike the other #GFile constructors, this will return None if a temporary file could not be created.

§tmpl

Template for the file name, as in g_file_open_tmp(), or None for a default template

§Returns

a new #GFile. Free the returned object with g_object_unref().

§iostream

on return, a #GFileIOStream for the created file

Source

pub fn for_parse_name(parse_name: &str) -> File

Constructs a #GFile with the given @parse_name (i.e. something given by g_file_get_parse_name()). This operation never fails, but the returned object might not support any I/O operation if the @parse_name cannot be parsed.

§parse_name

a file name or path to be parsed

§Returns

a new #GFile.

Trait Implementations§

Source§

impl Clone for File

Source§

fn clone(&self) -> Self

Makes a clone of this shared reference.

This increments the strong reference count of the object. Dropping the object will decrement it again.

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for File

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl HasParamSpec for File

Source§

type ParamSpec = ParamSpecObject

Source§

type SetValue = File

Preferred value to be used as setter for the associated ParamSpec.
Source§

type BuilderFn = fn(_: &str) -> ParamSpecObjectBuilder<'_, File>

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for File

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Hashes the memory address of this object.

1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for File

Source§

fn cmp(&self, other: &Self) -> Ordering

Comparison for two GObjects.

Compares the memory addresses of the provided objects.

1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<OT: ObjectType> PartialEq<OT> for File

Source§

fn eq(&self, other: &OT) -> bool

Equality for two GObjects.

Two GObjects are equal if their memory addresses are equal.

1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<OT: ObjectType> PartialOrd<OT> for File

Source§

fn partial_cmp(&self, other: &OT) -> Option<Ordering>

Partial comparison for two GObjects.

Compares the memory addresses of the provided objects.

1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for File

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for File

Source§

impl Send for File

Source§

impl Sync for File

Auto Trait Implementations§

§

impl Freeze for File

§

impl RefUnwindSafe for File

§

impl Unpin for File

§

impl UnwindSafe for File

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Cast for T
where T: ObjectType,

Source§

fn upcast<T>(self) -> T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a superclass or interface T. Read more
Source§

fn upcast_ref<T>(&self) -> &T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a reference of its superclass or interface T. Read more
Source§

fn downcast<T>(self) -> Result<T, Self>
where T: ObjectType, Self: MayDowncastTo<T>,

Tries to downcast to a subclass or interface implementor T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: ObjectType, Self: MayDowncastTo<T>,

Tries to downcast to a reference of its subclass or interface implementor T. Read more
Source§

fn dynamic_cast<T>(self) -> Result<T, Self>
where T: ObjectType,

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while upcast will do many checks at compile-time already. downcast will perform the same checks at runtime as dynamic_cast, but will also ensure some amount of compile-time safety. Read more
Source§

fn dynamic_cast_ref<T>(&self) -> Option<&T>
where T: ObjectType,

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more
Source§

unsafe fn unsafe_cast<T>(self) -> T
where T: ObjectType,

Casts to T unconditionally. Read more
Source§

unsafe fn unsafe_cast_ref<T>(&self) -> &T
where T: ObjectType,

Casts to &T unconditionally. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<O> FileExt for O
where O: IsA<File>,

Source§

fn append_to( &self, flags: FileCreateFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileOutputStream, Error>

Gets an output stream for appending data to the file. If the file doesn’t already exist it is created. Read more
Source§

fn append_to_async<P: FnOnce(Result<FileOutputStream, Error>) + 'static>( &self, flags: FileCreateFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously opens @self for appending. Read more
Source§

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

Source§

fn build_attribute_list_for_copy( &self, flags: FileCopyFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<GString, Error>

Available on crate feature v2_68 only.
Source§

fn copy( &self, destination: &impl IsA<File>, flags: FileCopyFlags, cancellable: Option<&impl IsA<Cancellable>>, progress_callback: Option<&mut dyn FnMut(i64, i64)>, ) -> Result<(), Error>

Source§

fn copy_attributes( &self, destination: &impl IsA<File>, flags: FileCopyFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

Copies the file attributes from @self to @destination. Read more
Source§

fn create( &self, flags: FileCreateFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileOutputStream, Error>

Creates a new file and returns an output stream for writing to it. The file must not already exist. Read more
Source§

fn create_async<P: FnOnce(Result<FileOutputStream, Error>) + 'static>( &self, flags: FileCreateFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist. Read more
Source§

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

Source§

fn create_readwrite( &self, flags: FileCreateFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileIOStream, Error>

Creates a new file and returns a stream for reading and writing to it. The file must not already exist. Read more
Source§

fn create_readwrite_async<P: FnOnce(Result<FileIOStream, Error>) + 'static>( &self, flags: FileCreateFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously creates a new file and returns a stream for reading and writing to it. The file must not already exist. Read more
Source§

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

Source§

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

Deletes a file. If the @self is a directory, it will only be deleted if it is empty. This has the same semantics as g_unlink(). Read more
Source§

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

Asynchronously delete a file. If the @self is a directory, it will only be deleted if it is empty. This has the same semantics as g_unlink(). Read more
Source§

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

Source§

fn dup(&self) -> File

Duplicates a #GFile handle. This operation does not duplicate the actual file or directory represented by the #GFile; see g_file_copy() if attempting to copy a file. Read more
Source§

fn eject_mountable_with_operation<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Starts an asynchronous eject on a mountable. When this operation has completed, @callback will be called with @user_user data, and the operation can be finalized with g_file_eject_mountable_with_operation_finish(). Read more
Source§

fn eject_mountable_with_operation_future( &self, flags: MountUnmountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)>, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

Source§

fn enumerate_children( &self, attributes: &str, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileEnumerator, Error>

Gets the requested information about the files in a directory. The result is a #GFileEnumerator object that will give out #GFileInfo objects for all the files in the directory. Read more
Source§

fn equal(&self, file2: &impl IsA<File>) -> bool

Source§

fn find_enclosing_mount( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<Mount, Error>

Gets a #GMount for the #GFile. Read more
Source§

fn basename(&self) -> Option<PathBuf>

Gets the base name (the last component of the path) for a given #GFile. Read more
Source§

fn child(&self, name: impl AsRef<Path>) -> File

Gets a child of @self with basename equal to @name. Read more
Source§

fn child_for_display_name(&self, display_name: &str) -> Result<File, Error>

Gets the child of @self for a given @display_name (i.e. a UTF-8 version of the name). If this function fails, it returns None and @error will be set. This is very useful when constructing a #GFile for a new file and the user entered the filename in the user interface, for instance when you select a directory and type a filename in the file selector. Read more
Source§

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

Gets the parent directory for the @self. If the @self represents the root directory of the file system, then None will be returned. Read more
Source§

fn parse_name(&self) -> GString

Gets the parse name of the @self. A parse name is a UTF-8 string that describes the file such that one can get the #GFile back using g_file_parse_name(). Read more
Source§

fn path(&self) -> Option<PathBuf>

Gets the local pathname for #GFile, if one exists. If non-None, this is guaranteed to be an absolute, canonical path. It might contain symlinks. Read more
Source§

fn relative_path(&self, descendant: &impl IsA<File>) -> Option<PathBuf>

Gets the path for @descendant relative to @self. Read more
Source§

fn uri(&self) -> GString

Gets the URI for the @self. Read more
Source§

fn uri_scheme(&self) -> Option<GString>

Gets the URI scheme for a #GFile. RFC 3986 decodes the scheme as: Read more
Source§

fn has_parent(&self, parent: Option<&impl IsA<File>>) -> bool

Checks if @self has a parent, and optionally, if it is @parent. Read more
Source§

fn has_prefix(&self, prefix: &impl IsA<File>) -> bool

Checks whether @self has the prefix specified by @prefix. Read more
Source§

fn has_uri_scheme(&self, uri_scheme: &str) -> bool

Checks to see if a #GFile has a given URI scheme. Read more
Source§

fn is_native(&self) -> bool

Checks to see if a file is native to the platform. Read more
Source§

fn load_bytes( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(Bytes, Option<GString>), Error>

Loads the contents of @self and returns it as #GBytes. Read more
Source§

fn load_bytes_async<P: FnOnce(Result<(Bytes, Option<GString>), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously loads the contents of @self as #GBytes. Read more
Source§

fn load_bytes_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<(Bytes, Option<GString>), Error>> + 'static>>

Source§

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

Creates a directory. Note that this will only create a child directory of the immediate parent directory of the path or URI given by the #GFile. To recursively create directories, see g_file_make_directory_with_parents(). This function will fail if the parent directory does not exist, setting @error to IOErrorEnum::NotFound. If the file system doesn’t support creating directories, this function will fail, setting @error to IOErrorEnum::NotSupported. Read more
Source§

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

Asynchronously creates a directory. Read more
Source§

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

Source§

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

Creates a directory and any parent directories that may not exist similar to ‘mkdir -p’. If the file system does not support creating directories, this function will fail, setting @error to IOErrorEnum::NotSupported. If the directory itself already exists, this function will fail setting @error to IOErrorEnum::Exists, unlike the similar g_mkdir_with_parents(). Read more
Creates a symbolic link named @self which contains the string @symlink_value. Read more
Source§

fn monitor( &self, flags: FileMonitorFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileMonitor, Error>

Obtains a file or directory monitor for the given file, depending on the type of the file. Read more
Source§

fn monitor_directory( &self, flags: FileMonitorFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileMonitor, Error>

Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported. Read more
Source§

fn monitor_file( &self, flags: FileMonitorFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileMonitor, Error>

Obtains a file monitor for the given file. If no file notification mechanism exists, then regular polling of the file is used. Read more
Source§

fn mount_enclosing_volume<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: MountMountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Starts a @mount_operation, mounting the volume that contains the file @self. Read more
Source§

fn mount_enclosing_volume_future( &self, flags: MountMountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)>, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

Source§

fn mount_mountable<P: FnOnce(Result<File, Error>) + 'static>( &self, flags: MountMountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Mounts a file of type G_FILE_TYPE_MOUNTABLE. Using @mount_operation, you can request callbacks when, for instance, passwords are needed during authentication. Read more
Source§

fn mount_mountable_future( &self, flags: MountMountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)>, ) -> Pin<Box_<dyn Future<Output = Result<File, Error>> + 'static>>

Source§

fn move_( &self, destination: &impl IsA<File>, flags: FileCopyFlags, cancellable: Option<&impl IsA<Cancellable>>, progress_callback: Option<&mut dyn FnMut(i64, i64)>, ) -> Result<(), Error>

Tries to move the file or directory @self to the location specified by @destination. If native move operations are supported then this is used, otherwise a copy + delete fallback is used. The native implementation may support moving directories (for instance on moves inside the same filesystem), but the fallback code does not. Read more
Source§

fn open_readwrite( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileIOStream, Error>

Opens an existing file for reading and writing. The result is a #GFileIOStream that can be used to read and write the contents of the file. Read more
Source§

fn open_readwrite_async<P: FnOnce(Result<FileIOStream, Error>) + 'static>( &self, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously opens @self for reading and writing. Read more
Source§

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

Source§

fn peek_path(&self) -> Option<PathBuf>

Exactly like g_file_get_path(), but caches the result via g_object_set_qdata_full(). This is useful for example in C applications which mix g_file_* APIs with native ones. It also avoids an extra duplicated string when possible, so will be generally more efficient. Read more
Source§

fn poll_mountable<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Polls a file of type FileType::Mountable. Read more
Source§

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

Source§

fn query_default_handler( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<AppInfo, Error>

Returns the #GAppInfo that is registered as the default application to handle the file specified by @self. Read more
Source§

fn query_default_handler_async<P: FnOnce(Result<AppInfo, Error>) + 'static>( &self, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Available on crate feature v2_60 only.
Async version of g_file_query_default_handler(). Read more
Source§

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

Available on crate feature v2_60 only.
Source§

fn query_exists(&self, cancellable: Option<&impl IsA<Cancellable>>) -> bool

Utility function to check if a particular file exists. Read more
Source§

fn query_file_type( &self, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> FileType

Utility function to inspect the #GFileType of a file. This is implemented using g_file_query_info() and as such does blocking I/O. Read more
Source§

fn query_filesystem_info( &self, attributes: &str, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileInfo, Error>

Similar to g_file_query_info(), but obtains information about the filesystem the @self is on, rather than the file itself. For instance the amount of space available and the type of the filesystem. Read more
Source§

fn query_filesystem_info_async<P: FnOnce(Result<FileInfo, Error>) + 'static>( &self, attributes: &str, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously gets the requested information about the filesystem that the specified @self is on. The result is a #GFileInfo object that contains key-value attributes (such as type or size for the file). Read more
Source§

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

Source§

fn query_info( &self, attributes: &str, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileInfo, Error>

Gets the requested information about specified @self. The result is a #GFileInfo object that contains key-value attributes (such as the type or size of the file). Read more
Source§

fn query_info_async<P: FnOnce(Result<FileInfo, Error>) + 'static>( &self, attributes: &str, flags: FileQueryInfoFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously gets the requested information about specified @self. The result is a #GFileInfo object that contains key-value attributes (such as type or size for the file). Read more
Source§

fn query_info_future( &self, attributes: &str, flags: FileQueryInfoFlags, io_priority: Priority, ) -> Pin<Box_<dyn Future<Output = Result<FileInfo, Error>> + 'static>>

Source§

fn query_settable_attributes( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileAttributeInfoList, Error>

Obtain the list of settable attributes for the file. Read more
Source§

fn query_writable_namespaces( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileAttributeInfoList, Error>

Obtain the list of attribute namespaces where new attributes can be created by a user. An example of this is extended attributes (in the “xattr” namespace). Read more
Source§

fn read( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileInputStream, Error>

Opens a file for reading. The result is a #GFileInputStream that can be used to read the contents of the file. Read more
Source§

fn read_async<P: FnOnce(Result<FileInputStream, Error>) + 'static>( &self, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously opens @self for reading. Read more
Source§

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

Source§

fn replace( &self, etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileOutputStream, Error>

Returns an output stream for overwriting the file, possibly creating a backup copy of the file first. If the file doesn’t exist, it will be created. Read more
Source§

fn replace_async<P: FnOnce(Result<FileOutputStream, Error>) + 'static>( &self, etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first. Read more
Source§

fn replace_future( &self, etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, io_priority: Priority, ) -> Pin<Box_<dyn Future<Output = Result<FileOutputStream, Error>> + 'static>>

Source§

fn replace_contents( &self, contents: &[u8], etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<Option<GString>, Error>

Replaces the contents of @self with @contents of @length bytes. Read more
Source§

fn replace_readwrite( &self, etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<FileIOStream, Error>

Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first. If the file doesn’t exist, it will be created. Read more
Source§

fn replace_readwrite_async<P: FnOnce(Result<FileIOStream, Error>) + 'static>( &self, etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first. Read more
Source§

fn replace_readwrite_future( &self, etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, io_priority: Priority, ) -> Pin<Box_<dyn Future<Output = Result<FileIOStream, Error>> + 'static>>

Source§

fn resolve_relative_path(&self, relative_path: impl AsRef<Path>) -> File

Resolves a relative path for @self to an absolute path. Read more
Source§

fn set_attribute_byte_string( &self, attribute: &str, value: &str, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

Sets @attribute of type FileAttributeType::ByteString to @value. If @attribute is of a different type, this operation will fail, returning false. Read more
Source§

fn set_attribute_int32( &self, attribute: &str, value: i32, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

Sets @attribute of type FileAttributeType::Int32 to @value. If @attribute is of a different type, this operation will fail. Read more
Source§

fn set_attribute_int64( &self, attribute: &str, value: i64, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

Sets @attribute of type FileAttributeType::Int64 to @value. If @attribute is of a different type, this operation will fail. Read more
Source§

fn set_attribute_string( &self, attribute: &str, value: &str, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

Sets @attribute of type FileAttributeType::String to @value. If @attribute is of a different type, this operation will fail. Read more
Source§

fn set_attribute_uint32( &self, attribute: &str, value: u32, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

Sets @attribute of type FileAttributeType::Uint32 to @value. If @attribute is of a different type, this operation will fail. Read more
Source§

fn set_attribute_uint64( &self, attribute: &str, value: u64, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

Sets @attribute of type FileAttributeType::Uint64 to @value. If @attribute is of a different type, this operation will fail. Read more
Source§

fn set_attributes_async<P: FnOnce(Result<FileInfo, Error>) + 'static>( &self, info: &FileInfo, flags: FileQueryInfoFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously sets the attributes of @self with @info. Read more
Source§

fn set_attributes_future( &self, info: &FileInfo, flags: FileQueryInfoFlags, io_priority: Priority, ) -> Pin<Box_<dyn Future<Output = Result<FileInfo, Error>> + 'static>>

Source§

fn set_attributes_from_info( &self, info: &FileInfo, flags: FileQueryInfoFlags, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

Tries to set all attributes in the #GFileInfo on the target values, not stopping on the first error. Read more
Source§

fn set_display_name( &self, display_name: &str, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<File, Error>

Renames @self to the specified display name. Read more
Source§

fn set_display_name_async<P: FnOnce(Result<File, Error>) + 'static>( &self, display_name: &str, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously sets the display name for a given #GFile. Read more
Source§

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

Source§

fn start_mountable<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: DriveStartFlags, start_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Starts a file of type FileType::Mountable. Using @start_operation, you can request callbacks when, for instance, passwords are needed during authentication. Read more
Source§

fn start_mountable_future( &self, flags: DriveStartFlags, start_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)>, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

Source§

fn stop_mountable<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Stops a file of type FileType::Mountable. Read more
Source§

fn stop_mountable_future( &self, flags: MountUnmountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)>, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

Source§

fn supports_thread_contexts(&self) -> bool

Checks if @self supports [thread-default contexts][g-main-context-push-thread-default-context]. If this returns false, you cannot perform asynchronous operations on @self in a thread that has a thread-default context. Read more
Source§

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

Sends @self to the “Trashcan”, if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Trashing is disabled for system mounts by default (see g_unix_mount_entry_is_system_internal()), so this call can return the IOErrorEnum::NotSupported error. Since GLib 2.66, the x-gvfs-notrash unix mount option can be used to disable g_file_trash() support for particular mounts, the IOErrorEnum::NotSupported error will be returned in that case. Since 2.82, the x-gvfs-trash unix mount option can be used to enable g_file_trash() support for particular system mounts. Read more
Source§

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

Asynchronously sends @self to the Trash location, if possible. Read more
Source§

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

Source§

fn unmount_mountable_with_operation<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Unmounts a file of type FileType::Mountable. Read more
Source§

fn unmount_mountable_with_operation_future( &self, flags: MountUnmountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)>, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

Source§

impl<O> FileExtManual for O
where O: IsA<File>,

Source§

fn replace_contents_async<B: AsRef<[u8]> + Send + 'static, R: FnOnce(Result<(B, GString), (B, Error)>) + 'static, C: IsA<Cancellable>>( &self, contents: B, etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, cancellable: Option<&C>, callback: R, )

Starts an asynchronous replacement of @self with the given @contents of @length bytes. @etag will replace the document’s current entity tag. Read more
Source§

fn replace_contents_future<B: AsRef<[u8]> + Send + 'static>( &self, contents: B, etag: Option<&str>, make_backup: bool, flags: FileCreateFlags, ) -> Pin<Box<dyn Future<Output = Result<(B, GString), (B, Error)>> + 'static>>

Source§

fn enumerate_children_async<P: IsA<Cancellable>, Q: FnOnce(Result<FileEnumerator, Error>) + 'static>( &self, attributes: &str, flags: FileQueryInfoFlags, io_priority: Priority, cancellable: Option<&P>, callback: Q, )

Source§

fn enumerate_children_future( &self, attributes: &str, flags: FileQueryInfoFlags, io_priority: Priority, ) -> Pin<Box<dyn Future<Output = Result<FileEnumerator, Error>> + 'static>>

Source§

fn copy_async<Q: FnOnce(Result<(), Error>) + 'static>( &self, destination: &impl IsA<File>, flags: FileCopyFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, progress_callback: Option<Box<dyn FnMut(i64, i64)>>, callback: Q, )

Copies the file @self to the location specified by @destination asynchronously. For details of the behaviour, see g_file_copy(). Read more
Source§

fn copy_future( &self, destination: &(impl IsA<File> + Clone + 'static), flags: FileCopyFlags, io_priority: Priority, ) -> (Pin<Box<dyn Future<Output = Result<(), Error>> + 'static>>, Pin<Box<dyn Stream<Item = (i64, i64)> + 'static>>)

Source§

fn load_contents( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(Slice<u8>, Option<GString>), Error>

Loads the content of the file into memory. The data is always zero-terminated, but this is not included in the resultant @length. The returned @contents should be freed with g_free() when no longer needed. Read more
Source§

fn load_contents_async<P: FnOnce(Result<(Slice<u8>, Option<GString>), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Starts an asynchronous load of the @self’s contents. Read more
Source§

fn load_contents_future( &self, ) -> Pin<Box<dyn Future<Output = Result<(Slice<u8>, Option<GString>), Error>> + 'static>>

Source§

fn load_partial_contents_async<P: FnMut(&[u8]) -> bool + 'static, Q: FnOnce(Result<(Slice<u8>, Option<GString>), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, read_more_callback: P, callback: Q, )

Reads the partial contents of a file. A #GFileReadMoreCallback should be used to stop reading from the file when appropriate, else this function will behave exactly as g_file_load_contents_async(). This operation can be finished by g_file_load_partial_contents_finish(). Read more
Source§

fn measure_disk_usage( &self, flags: FileMeasureFlags, cancellable: Option<&impl IsA<Cancellable>>, progress_callback: Option<Box<dyn FnMut(bool, u64, u64, u64) + 'static>>, ) -> Result<(u64, u64, u64), Error>

Recursively measures the disk usage of @self. Read more
Source§

fn measure_disk_usage_async<P: FnOnce(Result<(u64, u64, u64), Error>) + 'static>( &self, flags: FileMeasureFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, progress_callback: Option<Box<dyn FnMut(bool, u64, u64, u64) + 'static>>, callback: P, )

Recursively measures the disk usage of @self. Read more
Source§

fn measure_disk_usage_future( &self, flags: FileMeasureFlags, io_priority: Priority, ) -> (Pin<Box<dyn Future<Output = Result<(u64, u64, u64), Error>> + 'static>>, Pin<Box<dyn Stream<Item = (bool, u64, u64, u64)> + 'static>>)

Source§

fn move_async<Q: FnOnce(Result<(), Error>) + 'static>( &self, destination: &impl IsA<File>, flags: FileCopyFlags, io_priority: Priority, cancellable: Option<&impl IsA<Cancellable>>, progress_callback: Option<Box<dyn FnMut(i64, i64)>>, callback: Q, )

Available on crate feature v2_72 only.
Asynchronously moves a file @self to the location of @destination. For details of the behaviour, see g_file_move(). Read more
Available on crate feature v2_74 only.
Asynchronously creates a symbolic link named @self which contains the string @symlink_value. Read more
Available on crate feature v2_74 only.
Source§

fn move_future( &self, destination: &(impl IsA<File> + Clone + 'static), flags: FileCopyFlags, io_priority: Priority, ) -> (Pin<Box<dyn Future<Output = Result<(), Error>> + 'static>>, Pin<Box<dyn Stream<Item = (i64, i64)> + 'static>>)

Available on crate feature v2_72 only.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<T> ObjectExt for T
where T: ObjectType,

Source§

fn is<U>(&self) -> bool
where U: StaticType,

Returns true if the object is an instance of (can be cast to) T.
Source§

fn type_(&self) -> Type

Returns the type of the object.
Source§

fn object_class(&self) -> &Class<Object>

Returns the ObjectClass of the object. Read more
Source§

fn class(&self) -> &Class<T>
where T: IsClass,

Returns the class of the object.
Source§

fn class_of<U>(&self) -> Option<&Class<U>>
where U: IsClass,

Returns the class of the object in the given type T. Read more
Source§

fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>
where U: IsInterface,

Returns the interface T of the object. Read more
Source§

fn set_property(&self, property_name: &str, value: impl Into<Value>)

Sets the property property_name of the object to value value. Read more
Source§

fn set_property_from_value(&self, property_name: &str, value: &Value)

Sets the property property_name of the object to value value. Read more
Source§

fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])

Sets multiple properties of the object at once. Read more
Source§

fn set_properties_from_value(&self, property_values: &[(&str, Value)])

Sets multiple properties of the object at once. Read more
Source§

fn property<V>(&self, property_name: &str) -> V
where V: for<'b> FromValue<'b> + 'static,

Gets the property property_name of the object and cast it to the type V. Read more
Source§

fn property_value(&self, property_name: &str) -> Value

Gets the property property_name of the object. Read more
Source§

fn has_property(&self, property_name: &str, type_: Option<Type>) -> bool

Check if the object has a property property_name of the given type_. Read more
Source§

fn property_type(&self, property_name: &str) -> Option<Type>

Get the type of the property property_name of this object. Read more
Source§

fn find_property(&self, property_name: &str) -> Option<ParamSpec>

Get the ParamSpec of the property property_name of this object.
Source§

fn list_properties(&self) -> PtrSlice<ParamSpec>

Return all ParamSpec of the properties of this object.
Source§

fn freeze_notify(&self) -> PropertyNotificationFreezeGuard

Freeze all property notifications until the return guard object is dropped. Read more
Source§

unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)
where QD: 'static,

Set arbitrary data on this object with the given key. Read more
Source§

unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>
where QD: 'static,

Return previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>
where QD: 'static,

Retrieve previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn set_data<QD>(&self, key: &str, value: QD)
where QD: 'static,

Set arbitrary data on this object with the given key. Read more
Source§

unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>
where QD: 'static,

Return previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>
where QD: 'static,

Retrieve previously set arbitrary data of this object with the given key. Read more
Source§

fn block_signal(&self, handler_id: &SignalHandlerId)

Block a given signal handler. Read more
Source§

fn unblock_signal(&self, handler_id: &SignalHandlerId)

Unblock a given signal handler.
Source§

fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)

Stop emission of the currently emitted signal.
Source§

fn stop_signal_emission_by_name(&self, signal_name: &str)

Stop emission of the currently emitted signal by the (possibly detailed) signal name.
Source§

fn connect<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,

Connect to the signal signal_name on this object. Read more
Source§

fn connect_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,

Connect to the signal signal_id on this object. Read more
Source§

fn connect_local<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + 'static,

Connect to the signal signal_name on this object. Read more
Source§

fn connect_local_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + 'static,

Connect to the signal signal_id on this object. Read more
Source§

unsafe fn connect_unsafe<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value>,

Connect to the signal signal_name on this object. Read more
Source§

unsafe fn connect_unsafe_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value>,

Connect to the signal signal_id on this object. Read more
Source§

fn connect_closure( &self, signal_name: &str, after: bool, closure: RustClosure, ) -> SignalHandlerId

Connect a closure to the signal signal_name on this object. Read more
Source§

fn connect_closure_id( &self, signal_id: SignalId, details: Option<Quark>, after: bool, closure: RustClosure, ) -> SignalHandlerId

Connect a closure to the signal signal_id on this object. Read more
Source§

fn watch_closure(&self, closure: &impl AsRef<Closure>)

Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to invoke_with_values, or invoke when using Rust closures.
Source§

fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> R

Emit signal by signal id. Read more
Source§

fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>

Same as Self::emit but takes Value for the arguments.
Source§

fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> R

Emit signal by its name. Read more
Source§

fn emit_by_name_with_values( &self, signal_name: &str, args: &[Value], ) -> Option<Value>

Emit signal by its name. Read more
Source§

fn emit_by_name_with_details<R>( &self, signal_name: &str, details: Quark, args: &[&dyn ToValue], ) -> R

Emit signal by its name with details. Read more
Source§

fn emit_by_name_with_details_and_values( &self, signal_name: &str, details: Quark, args: &[Value], ) -> Option<Value>

Emit signal by its name with details. Read more
Source§

fn emit_with_details<R>( &self, signal_id: SignalId, details: Quark, args: &[&dyn ToValue], ) -> R

Emit signal by signal id with details. Read more
Source§

fn emit_with_details_and_values( &self, signal_id: SignalId, details: Quark, args: &[Value], ) -> Option<Value>

Emit signal by signal id with details. Read more
Source§

fn disconnect(&self, handler_id: SignalHandlerId)

Disconnect a previously connected signal handler.
Source§

fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
where F: Fn(&T, &ParamSpec) + Send + Sync + 'static,

Connect to the notify signal of the object. Read more
Source§

fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
where F: Fn(&T, &ParamSpec) + 'static,

Connect to the notify signal of the object. Read more
Source§

unsafe fn connect_notify_unsafe<F>( &self, name: Option<&str>, f: F, ) -> SignalHandlerId
where F: Fn(&T, &ParamSpec),

Connect to the notify signal of the object. Read more
Source§

fn notify(&self, property_name: &str)

Notify that the given property has changed its value. Read more
Source§

fn notify_by_pspec(&self, pspec: &ParamSpec)

Notify that the given property has changed its value. Read more
Source§

fn downgrade(&self) -> WeakRef<T>

Downgrade this object to a weak reference.
Source§

fn add_weak_ref_notify<F>(&self, f: F) -> WeakRefNotify<T>
where F: FnOnce() + Send + 'static,

Add a callback to be notified when the Object is disposed.
Source§

fn add_weak_ref_notify_local<F>(&self, f: F) -> WeakRefNotify<T>
where F: FnOnce() + 'static,

Add a callback to be notified when the Object is disposed. Read more
Source§

fn bind_property<'a, 'f, 't, O>( &'a self, source_property: &'a str, target: &'a O, target_property: &'a str, ) -> BindingBuilder<'a, 'f, 't>
where O: ObjectType,

Bind property source_property on this object to the target_property on the target object. Read more
Source§

fn ref_count(&self) -> u32

Returns the strong reference count of this object.
Source§

unsafe fn run_dispose(&self)

Runs the dispose mechanism of the object. Read more
Source§

impl<T> Property for T
where T: HasParamSpec,

Source§

type Value = T

Source§

impl<T> PropertyGet for T
where T: HasParamSpec,

Source§

type Value = T

Source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSendValue for T
where T: Send + ToValue + ?Sized,

Source§

fn to_send_value(&self) -> SendValue

Returns a SendValue clone of self.
Source§

impl<T> TransparentType for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,

Source§

impl<Super, Sub> MayDowncastTo<Sub> for Super
where Super: IsA<Super>, Sub: IsA<Super>,