Struct BaseInfo

Source
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

Source

pub fn as_ptr(&self) -> *mut GIBaseInfo

Return the inner pointer to the underlying C value.

Source§

impl BaseInfo

Source

pub fn attribute(&self, name: &str) -> Option<String>

Retrieve an arbitrary attribute associated with this node.

§name

a freeform string naming an attribute

§Returns

The value of the attribute, or None if no such attribute exists

Source

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

Source

pub fn name(&self) -> Option<String>

Obtain the name of the self. What the name represents depends on the InfoType of the self. For instance for GIFunctionInfo it is the name of the function.

§Returns

the name of self or None if it lacks a name.

Source

pub fn namespace(&self) -> Option<String>

Obtain the namespace of self.

§Returns

the namespace

Source

pub fn type_(&self) -> InfoType

Obtain the info type of the GIBaseInfo.

§Returns

the info type of self

Source

pub fn typelib(&self) -> Option<Typelib>

Obtain the typelib this self belongs to

§Returns

the typelib.

Source

pub fn is_deprecated(&self) -> bool

Obtain whether the self is represents a metadata which is deprecated or not.

§Returns

true if deprecated

Source

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 Clone for BaseInfo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BaseInfo

Source§

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

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

impl Hash for BaseInfo

Source§

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

Feeds this value into the given Hasher. Read more
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 BaseInfo

Source§

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

This method returns an Ordering between self and other. Read more
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 PartialEq for BaseInfo

Source§

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

Tests for self and other values to be equal, and is used by ==.
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 PartialOrd for BaseInfo

Source§

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

This method returns an ordering between self and other values if one exists. Read more
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 BaseInfo

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for BaseInfo

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

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

impl<T> ToClosureReturnValue for T
where T: ToValue,

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