pub struct BaseInfo { /* private fields */ }
Expand description
GIBaseInfo is the common base struct of all other Info structs
accessible through the Repository
API.
All info structures can be cast to a BaseInfo
, for instance:
⚠️ The following code is in C ⚠️
GIFunctionInfo *function_info = ...;
GIBaseInfo *info = (GIBaseInfo *) function_info;
Most Repository
APIs returning a BaseInfo
is actually
creating a new struct; in other words, g_base_info_unref()
has to
be called when done accessing the data.
BaseInfo
structuress are normally accessed by calling either
[RepositoryExt::find_by_name()
][crate::prelude::RepositoryExt::find_by_name()], [RepositoryExt::find_by_gtype()
][crate::prelude::RepositoryExt::find_by_gtype()] or
[RepositoryExt::info()
][crate::prelude::RepositoryExt::info()].
⚠️ The following code is in C ⚠️
GIBaseInfo *button_info =
g_irepository_find_by_name (NULL, "Gtk", "Button");
// ... use button_info ...
g_base_info_unref (button_info);
§Hierarchy
⚠️ The following code is in plain ⚠️
GIBaseInfo
+---- GIArgInfo
+---- GICallableInfo
+---- GIConstantInfo
+---- GIFieldInfo
+---- GIPropertyInfo
+---- GIRegisteredTypeInfo
+---- GITypeInfo
Implementations§
Source§impl BaseInfo
impl BaseInfo
Sourcepub fn as_ptr(&self) -> *mut GIBaseInfo
pub fn as_ptr(&self) -> *mut GIBaseInfo
Return the inner pointer to the underlying C value.
Source§impl BaseInfo
impl BaseInfo
Sourcepub fn container(&self) -> Option<BaseInfo>
pub fn container(&self) -> Option<BaseInfo>
Obtain the container of the self
. The container is the parent
GIBaseInfo. For instance, the parent of a GIFunctionInfo
is an
GIObjectInfo
or GIInterfaceInfo
.
§Returns
the container
Sourcepub fn is_deprecated(&self) -> bool
pub fn is_deprecated(&self) -> bool
Sourcepub fn iterate_attributes(&self) -> AttributeIter<'_> ⓘ
pub fn iterate_attributes(&self) -> AttributeIter<'_> ⓘ
Iterate over all attributes associated with this node. The iterator
structure is typically stack allocated, and must have its first
member initialized to None
. Attributes are arbitrary namespaced key–value
pairs which can be attached to almost any item. They are intended for use
by software higher in the toolchain than bindings, and are distinct from
normal GIR annotations.
Both the name
and value
should be treated as constants
and must not be freed.
⚠️ The following code is in C ⚠️
void
print_attributes (GIBaseInfo *info)
{
GIAttributeIter iter = { 0, };
char *name;
char *value;
while (g_base_info_iterate_attributes (info, &iter, &name, &value))
{
g_print ("attribute name: %s value: %s", name, value);
}
}
§iterator
a AttributeIter
structure, must be initialized; see below
§Returns
true
if there are more attributes
§name
Returned name, must not be freed
§value
Returned name, must not be freed
Trait Implementations§
Source§impl Ord for BaseInfo
impl Ord for BaseInfo
Source§impl PartialOrd for BaseInfo
impl PartialOrd for BaseInfo
Source§impl StaticType for BaseInfo
impl StaticType for BaseInfo
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.