gio

Struct FileInfo

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

Stores information about a file system object referenced by a File.

Functionality for manipulating basic metadata for files. GFileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.

See the file attributes document for more information on how GIO handles file attributes.

To obtain a GFileInfo for a File, use FileExt::query_info() (or its async variant). To obtain a GFileInfo for a file input or output stream, use FileInputStreamExt::query_info() or FileOutputStreamExt::query_info() (or their async variants).

To change the actual attributes of a file, you should then set the attribute in the GFileInfo and call FileExt::set_attributes_from_info() or FileExt::set_attributes_async() on a GFile.

However, not all attributes can be changed in the file. For instance, the actual size of a file cannot be changed via set_size(). You may call FileExt::query_settable_attributes() and FileExt::query_writable_namespaces() to discover the settable attributes of a particular file at runtime.

The direct accessors, such as name(), are slightly more optimized than the generic attribute accessors, such as attribute_byte_string().This optimization will matter only if calling the API in a tight loop.

It is an error to call these accessors without specifying their required file attributes when creating the GFileInfo. Use has_attribute() or list_attributes() to check what attributes are specified for a GFileInfo.

FileAttributeMatcher allows for searching through a GFileInfo for attributes.

§Implements

[trait@glib::ObjectExt]

GLib type: GObject with reference counted clone semantics.

Implementations§

Source§

impl FileInfo

Source

pub fn modification_time(&self) -> SystemTime

👎Deprecated

Gets the modification time of the current @self and sets it in @result.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_TIME_MODIFIED. If FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided it will be used too.

§Deprecated since 2.62

Use g_file_info_get_modification_date_time() instead, as #GTimeVal is deprecated due to the year 2038 problem.

§Returns
§result

a #GTimeVal.

Source

pub fn set_modification_time(&self, mtime: SystemTime)

👎Deprecated

Sets the FILE_ATTRIBUTE_TIME_MODIFIED and FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given time value.

FILE_ATTRIBUTE_TIME_MODIFIED_NSEC will be cleared.

§Deprecated since 2.62

Use g_file_info_set_modification_date_time() instead, as #GTimeVal is deprecated due to the year 2038 problem.

§mtime

a #GTimeVal.

Source

pub fn attribute_stringv(&self, attribute: &str) -> StrV

Gets the value of a stringv attribute. If the attribute does not contain a stringv, None will be returned.

§attribute

a file attribute key.

§Returns

the contents of the @attribute value as a stringv, or None otherwise. Do not free. These returned strings are UTF-8.

Source

pub fn set_attribute_stringv(&self, attribute: &str, attr_value: impl IntoStrV)

Sets the @attribute to contain the given @attr_value, if possible.

Sinze: 2.22

§attribute

a file attribute key

§attr_value

a None terminated array of UTF-8 strings.

Source§

impl FileInfo

Source

pub fn new() -> FileInfo

Creates a new file info structure.

§Returns

a #GFileInfo.

Source

pub fn clear_status(&self)

Clears the status information from @self.

Source

pub fn copy_into(&self, dest_info: &FileInfo)

First clears all of the [GFileAttribute][gio-GFileAttribute] of @dest_info, and then copies all of the file attributes from @self to @dest_info.

§dest_info

destination to copy attributes to.

Source

pub fn dup(&self) -> FileInfo

Duplicates a file info structure.

§Returns

a duplicate #GFileInfo of @self.

Source

pub fn access_date_time(&self) -> Option<DateTime>

Available on crate feature v2_70 only.

Gets the access time of the current @self and returns it as a #GDateTime.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_TIME_ACCESS. If FILE_ATTRIBUTE_TIME_ACCESS_USEC is provided, the resulting #GDateTime will additionally have microsecond precision.

If nanosecond precision is needed, FILE_ATTRIBUTE_TIME_ACCESS_NSEC must be queried separately using g_file_info_get_attribute_uint32().

§Returns

access time, or None if unknown

Source

pub fn attribute_as_string(&self, attribute: &str) -> Option<GString>

Gets the value of an attribute, formatted as a string. This escapes things as needed to make the string valid UTF-8.

§attribute

a file attribute key.

§Returns

a UTF-8 string associated with the given @attribute, or None if the attribute wasn’t set. When you’re done with the string it must be freed with g_free().

Source

pub fn boolean(&self, attribute: &str) -> bool

Gets the value of a boolean attribute. If the attribute does not contain a boolean value, false will be returned.

§attribute

a file attribute key.

§Returns

the boolean value contained within the attribute.

Source

pub fn attribute_byte_string(&self, attribute: &str) -> Option<GString>

Gets the value of a byte string attribute. If the attribute does not contain a byte string, None will be returned.

§attribute

a file attribute key.

§Returns

the contents of the @attribute value as a byte string, or None otherwise.

Source

pub fn attribute_file_path(&self, attribute: &str) -> Option<PathBuf>

Available on crate feature v2_78 only.

Gets the value of a byte string attribute as a file path.

If the attribute does not contain a byte string, NULL will be returned.

This function is meant to be used by language bindings that have specific handling for Unix paths.

§attribute

a file attribute key.

§Returns

the contents of the @attribute value as a file path, or None otherwise.

Source

pub fn attribute_int32(&self, attribute: &str) -> i32

Gets a signed 32-bit integer contained within the attribute. If the attribute does not contain a signed 32-bit integer, or is invalid, 0 will be returned.

§attribute

a file attribute key.

§Returns

a signed 32-bit integer from the attribute.

Source

pub fn attribute_int64(&self, attribute: &str) -> i64

Gets a signed 64-bit integer contained within the attribute. If the attribute does not contain a signed 64-bit integer, or is invalid, 0 will be returned.

§attribute

a file attribute key.

§Returns

a signed 64-bit integer from the attribute.

Source

pub fn attribute_object(&self, attribute: &str) -> Option<Object>

Gets the value of a #GObject attribute. If the attribute does not contain a #GObject, None will be returned.

§attribute

a file attribute key.

§Returns

a #GObject associated with the given @attribute, or None otherwise.

Source

pub fn attribute_status(&self, attribute: &str) -> FileAttributeStatus

Gets the attribute status for an attribute key.

§attribute

a file attribute key

§Returns

a #GFileAttributeStatus for the given @attribute, or FileAttributeStatus::Unset if the key is invalid.

Source

pub fn attribute_string(&self, attribute: &str) -> Option<GString>

Gets the value of a string attribute. If the attribute does not contain a string, None will be returned.

§attribute

a file attribute key.

§Returns

the contents of the @attribute value as a UTF-8 string, or None otherwise.

Source

pub fn attribute_type(&self, attribute: &str) -> FileAttributeType

Gets the attribute type for an attribute key.

§attribute

a file attribute key.

§Returns

a #GFileAttributeType for the given @attribute, or FileAttributeType::Invalid if the key is not set.

Source

pub fn attribute_uint32(&self, attribute: &str) -> u32

Gets an unsigned 32-bit integer contained within the attribute. If the attribute does not contain an unsigned 32-bit integer, or is invalid, 0 will be returned.

§attribute

a file attribute key.

§Returns

an unsigned 32-bit integer from the attribute.

Source

pub fn attribute_uint64(&self, attribute: &str) -> u64

Gets a unsigned 64-bit integer contained within the attribute. If the attribute does not contain an unsigned 64-bit integer, or is invalid, 0 will be returned.

§attribute

a file attribute key.

§Returns

a unsigned 64-bit integer from the attribute.

Source

pub fn content_type(&self) -> Option<GString>

Gets the file’s content type.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

§Returns

a string containing the file’s content type, or None if unknown.

Source

pub fn creation_date_time(&self) -> Option<DateTime>

Available on crate feature v2_70 only.

Gets the creation time of the current @self and returns it as a #GDateTime.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_TIME_CREATED. If FILE_ATTRIBUTE_TIME_CREATED_USEC is provided, the resulting #GDateTime will additionally have microsecond precision.

If nanosecond precision is needed, FILE_ATTRIBUTE_TIME_CREATED_NSEC must be queried separately using g_file_info_get_attribute_uint32().

§Returns

creation time, or None if unknown

Source

pub fn deletion_date(&self) -> Option<DateTime>

Returns the #GDateTime representing the deletion date of the file, as available in FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, None is returned.

§Returns

a #GDateTime, or None.

Source

pub fn display_name(&self) -> GString

Gets a display name for a file. This is guaranteed to always be set.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

§Returns

a string containing the display name.

Source

pub fn edit_name(&self) -> GString

Gets the edit name for a file.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_EDIT_NAME.

§Returns

a string containing the edit name.

Source

pub fn etag(&self) -> Option<GString>

Gets the entity tag for a given #GFileInfo. See FILE_ATTRIBUTE_ETAG_VALUE.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_ETAG_VALUE.

§Returns

a string containing the value of the “etag:value” attribute.

Source

pub fn file_type(&self) -> FileType

Gets a file’s type (whether it is a regular file, symlink, etc). This is different from the file’s content type, see g_file_info_get_content_type().

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_TYPE.

§Returns

a #GFileType for the given file.

Source

pub fn icon(&self) -> Option<Icon>

Gets the icon for a file.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_ICON.

§Returns

#GIcon for the given @self.

Source

pub fn is_backup(&self) -> bool

Checks if a file is a backup file.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_IS_BACKUP.

§Returns

true if file is a backup file, false otherwise.

Source

pub fn is_hidden(&self) -> bool

Checks if a file is hidden.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

§Returns

true if the file is a hidden file, false otherwise.

Checks if a file is a symlink.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

§Returns

true if the given @self is a symlink.

Source

pub fn modification_date_time(&self) -> Option<DateTime>

Available on crate feature v2_62 only.

Gets the modification time of the current @self and returns it as a #GDateTime.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_TIME_MODIFIED. If FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided, the resulting #GDateTime will additionally have microsecond precision.

If nanosecond precision is needed, FILE_ATTRIBUTE_TIME_MODIFIED_NSEC must be queried separately using g_file_info_get_attribute_uint32().

§Returns

modification time, or None if unknown

Source

pub fn name(&self) -> PathBuf

Gets the name for a file. This is guaranteed to always be set.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_NAME.

§Returns

a string containing the file name.

Source

pub fn size(&self) -> i64

Gets the file’s size (in bytes). The size is retrieved through the value of the FILE_ATTRIBUTE_STANDARD_SIZE attribute and is converted from #guint64 to #goffset before returning the result.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_SIZE.

§Returns

a #goffset containing the file’s size (in bytes).

Source

pub fn sort_order(&self) -> i32

Gets the value of the sort_order attribute from the #GFileInfo. See FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

§Returns

a #gint32 containing the value of the “standard::sort_order” attribute.

Source

pub fn symbolic_icon(&self) -> Option<Icon>

Gets the symbolic icon for a file.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

§Returns

#GIcon for the given @self.

Gets the symlink target for a given #GFileInfo.

It is an error to call this if the #GFileInfo does not contain FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET.

§Returns

a string containing the symlink target.

Source

pub fn has_attribute(&self, attribute: &str) -> bool

Checks if a file info structure has an attribute named @attribute.

§attribute

a file attribute key.

§Returns

true if @self has an attribute named @attribute, false otherwise.

Source

pub fn has_namespace(&self, name_space: &str) -> bool

Checks if a file info structure has an attribute in the specified @name_space.

§name_space

a file attribute namespace.

§Returns

true if @self has an attribute in @name_space, false otherwise.

Source

pub fn list_attributes(&self, name_space: Option<&str>) -> Vec<GString>

Lists the file info structure’s attributes.

§name_space

a file attribute key’s namespace, or None to list all attributes.

§Returns

a null-terminated array of strings of all of the possible attribute types for the given @name_space, or None on error.

Source

pub fn remove_attribute(&self, attribute: &str)

Removes all cases of @attribute from @self if it exists.

§attribute

a file attribute key.

Source

pub fn set_access_date_time(&self, atime: &DateTime)

Available on crate feature v2_70 only.

Sets the FILE_ATTRIBUTE_TIME_ACCESS and FILE_ATTRIBUTE_TIME_ACCESS_USEC attributes in the file info to the given date/time value.

FILE_ATTRIBUTE_TIME_ACCESS_NSEC will be cleared.

§atime

a #GDateTime.

Source

pub fn set_attribute_boolean(&self, attribute: &str, attr_value: bool)

Sets the @attribute to contain the given @attr_value, if possible.

§attribute

a file attribute key.

§attr_value

a boolean value.

Source

pub fn set_attribute_byte_string(&self, attribute: &str, attr_value: &str)

Sets the @attribute to contain the given @attr_value, if possible.

§attribute

a file attribute key.

§attr_value

a byte string.

Source

pub fn set_attribute_file_path( &self, attribute: &str, attr_value: impl AsRef<Path>, )

Available on crate feature v2_78 only.

Sets the @attribute to contain the given @attr_value, if possible.

This function is meant to be used by language bindings that have specific handling for Unix paths.

§attribute

a file attribute key.

§attr_value

a file path.

Source

pub fn set_attribute_int32(&self, attribute: &str, attr_value: i32)

Sets the @attribute to contain the given @attr_value, if possible.

§attribute

a file attribute key.

§attr_value

a signed 32-bit integer

Source

pub fn set_attribute_int64(&self, attribute: &str, attr_value: i64)

Sets the @attribute to contain the given @attr_value, if possible.

§attribute

attribute name to set.

§attr_value

int64 value to set attribute to.

Source

pub fn set_attribute_mask(&self, mask: &FileAttributeMatcher)

Sets @mask on @self to match specific attribute types.

§mask

a #GFileAttributeMatcher.

Source

pub fn set_attribute_object( &self, attribute: &str, attr_value: &impl IsA<Object>, )

Sets the @attribute to contain the given @attr_value, if possible.

§attribute

a file attribute key.

§attr_value

a #GObject.

Source

pub fn set_attribute_status( &self, attribute: &str, status: FileAttributeStatus, ) -> bool

Sets the attribute status for an attribute key. This is only needed by external code that implement g_file_set_attributes_from_info() or similar functions.

The attribute must exist in @self for this to work. Otherwise false is returned and @self is unchanged.

§attribute

a file attribute key

§status

a #GFileAttributeStatus

§Returns

true if the status was changed, false if the key was not set.

Source

pub fn set_attribute_string(&self, attribute: &str, attr_value: &str)

Sets the @attribute to contain the given @attr_value, if possible.

§attribute

a file attribute key.

§attr_value

a UTF-8 string.

Source

pub fn set_attribute_uint32(&self, attribute: &str, attr_value: u32)

Sets the @attribute to contain the given @attr_value, if possible.

§attribute

a file attribute key.

§attr_value

an unsigned 32-bit integer.

Source

pub fn set_attribute_uint64(&self, attribute: &str, attr_value: u64)

Sets the @attribute to contain the given @attr_value, if possible.

§attribute

a file attribute key.

§attr_value

an unsigned 64-bit integer.

Source

pub fn set_content_type(&self, content_type: &str)

Sets the content type attribute for a given #GFileInfo. See FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

§content_type

a content type. See [GContentType][gio-GContentType]

Source

pub fn set_creation_date_time(&self, creation_time: &DateTime)

Available on crate feature v2_70 only.

Sets the FILE_ATTRIBUTE_TIME_CREATED and FILE_ATTRIBUTE_TIME_CREATED_USEC attributes in the file info to the given date/time value.

FILE_ATTRIBUTE_TIME_CREATED_NSEC will be cleared.

§creation_time

a #GDateTime.

Source

pub fn set_display_name(&self, display_name: &str)

Sets the display name for the current #GFileInfo. See FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

§display_name

a string containing a display name.

Source

pub fn set_edit_name(&self, edit_name: &str)

Sets the edit name for the current file. See FILE_ATTRIBUTE_STANDARD_EDIT_NAME.

§edit_name

a string containing an edit name.

Source

pub fn set_file_type(&self, type_: FileType)

Sets the file type in a #GFileInfo to @type_. See FILE_ATTRIBUTE_STANDARD_TYPE.

§type_

a #GFileType.

Source

pub fn set_icon(&self, icon: &impl IsA<Icon>)

Sets the icon for a given #GFileInfo. See FILE_ATTRIBUTE_STANDARD_ICON.

§icon

a #GIcon.

Source

pub fn set_is_hidden(&self, is_hidden: bool)

Sets the “is_hidden” attribute in a #GFileInfo according to @is_hidden. See FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

§is_hidden

a #gboolean.

Sets the “is_symlink” attribute in a #GFileInfo according to @is_symlink. See FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

a #gboolean.

Source

pub fn set_modification_date_time(&self, mtime: &DateTime)

Available on crate feature v2_62 only.

Sets the FILE_ATTRIBUTE_TIME_MODIFIED and FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given date/time value.

FILE_ATTRIBUTE_TIME_MODIFIED_NSEC will be cleared.

§mtime

a #GDateTime.

Source

pub fn set_name(&self, name: impl AsRef<Path>)

Sets the name attribute for the current #GFileInfo. See FILE_ATTRIBUTE_STANDARD_NAME.

§name

a string containing a name.

Source

pub fn set_size(&self, size: i64)

Sets the FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size.

§size

a #goffset containing the file’s size.

Source

pub fn set_sort_order(&self, sort_order: i32)

Sets the sort order attribute in the file info structure. See FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

§sort_order

a sort order integer.

Source

pub fn set_symbolic_icon(&self, icon: &impl IsA<Icon>)

Sets the symbolic icon for a given #GFileInfo. See FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

§icon

a #GIcon.

Sets the FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.

a static string containing a path to a symlink target.

Source

pub fn unset_attribute_mask(&self)

Unsets a mask set by g_file_info_set_attribute_mask(), if one is set.

Trait Implementations§

Source§

impl Clone for FileInfo

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 FileInfo

Source§

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

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

impl Default for FileInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl HasParamSpec for FileInfo

Source§

type ParamSpec = ParamSpecObject

Source§

type SetValue = FileInfo

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

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

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for FileInfo

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 FileInfo

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 ParentClassIs for FileInfo

Source§

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

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 FileInfo

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 FileInfo

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for FileInfo

Auto Trait Implementations§

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<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<U> IsSubclassableExt for U

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) -> bool

Check if the object has a property property_name.
Source§

fn has_property_with_type(&self, property_name: &str, type_: Type) -> bool

Check if the object has a property property_name of the given type_.
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> 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>,