Trait RepositoryExt

Source
pub trait RepositoryExt: 'static {
Show 18 methods // Required methods fn enumerate_versions(&self, namespace_: &str) -> Vec<GString>; fn find_by_error_domain(&self, domain: Quark) -> Option<EnumInfo>; fn find_by_gtype(&self, gtype: Type) -> Option<BaseInfo>; fn find_by_name(&self, namespace_: &str, name: &str) -> Option<BaseInfo>; fn c_prefix(&self, namespace_: &str) -> Option<GString>; fn dependencies(&self, namespace_: &str) -> Vec<GString>; fn immediate_dependencies(&self, namespace_: &str) -> Vec<GString>; fn info(&self, namespace_: &str, index: i32) -> Option<BaseInfo>; fn loaded_namespaces(&self) -> Vec<GString>; fn n_infos(&self, namespace_: &str) -> i32; fn object_gtype_interfaces(&self, gtype: Type) -> Vec<InterfaceInfo> ; fn shared_library(&self, namespace_: &str) -> Option<GString>; fn typelib_path(&self, namespace_: &str) -> Option<GString>; fn version(&self, namespace_: &str) -> Option<GString>; fn is_registered(&self, namespace_: &str, version: Option<&str>) -> bool; fn load_typelib( &self, typelib: &mut Typelib, flags: RepositoryLoadFlags, ) -> Result<GString, Error>; fn require( &self, namespace_: &str, version: Option<&str>, flags: RepositoryLoadFlags, ) -> Result<Typelib, Error>; fn require_private( &self, typelib_dir: &str, namespace_: &str, version: Option<&str>, flags: RepositoryLoadFlags, ) -> Result<Typelib, Error>;
}
Expand description

Trait containing all Repository methods.

§Implementors

Repository

Required Methods§

Source

fn enumerate_versions(&self, namespace_: &str) -> Vec<GString>

Obtain an unordered list of versions (either currently loaded or available) for namespace_ in this self.

§namespace_

GI namespace, e.g. “Gtk”

§Returns

the array of versions.

Source

fn find_by_error_domain(&self, domain: Quark) -> Option<EnumInfo>

Searches for the enum type corresponding to the given [glib::Error][crate::glib::Error] domain. Before calling this function for a particular namespace, you must call require() once to load the namespace, or otherwise ensure the namespace has already been loaded.

§domain

a [glib::Error][crate::glib::Error] domain

§Returns

GIEnumInfo representing metadata about domain’s enum type, or None

Source

fn find_by_gtype(&self, gtype: Type) -> Option<BaseInfo>

Searches all loaded namespaces for a particular GType. Note that in order to locate the metadata, the namespace corresponding to the type must first have been loaded. There is currently no mechanism for determining the namespace which corresponds to an arbitrary GType - thus, this function will operate most reliably when you know the GType to originate from be from a loaded namespace.

§gtype

GType to search for

§Returns

BaseInfo representing metadata about type_, or None

Source

fn find_by_name(&self, namespace_: &str, name: &str) -> Option<BaseInfo>

Searches for a particular entry in a namespace. Before calling this function for a particular namespace, you must call require() once to load the namespace, or otherwise ensure the namespace has already been loaded.

§namespace_

Namespace which will be searched

§name

Entry name to find

§Returns

BaseInfo representing metadata about name, or None

Source

fn c_prefix(&self, namespace_: &str) -> Option<GString>

This function returns the “C prefix”, or the C level namespace associated with the given introspection namespace. Each C symbol starts with this prefix, as well each GType in the library.

Note: The namespace must have already been loaded using a function such as require() before calling this function.

§namespace_

Namespace to inspect

§Returns

C namespace prefix, or None if none associated

Source

fn dependencies(&self, namespace_: &str) -> Vec<GString>

Retrieves all (transitive) versioned dependencies for namespace_.

The strings are of the form namespace-version.

Note: namespace_ must have already been loaded using a function such as require() before calling this function.

To get only the immediate dependencies for namespace_, use immediate_dependencies().

§namespace_

Namespace of interest

§Returns

all versioned dependencies

Source

fn immediate_dependencies(&self, namespace_: &str) -> Vec<GString>

Return an array of the immediate versioned dependencies for namespace_. Returned strings are of the form namespace-version.

Note: namespace_ must have already been loaded using a function such as require() before calling this function.

To get the transitive closure of dependencies for namespace_, use dependencies().

§namespace_

Namespace of interest

§Returns

Zero-terminated string array of immediate versioned dependencies

Source

fn info(&self, namespace_: &str, index: i32) -> Option<BaseInfo>

This function returns a particular metadata entry in the given namespace namespace_. The namespace must have already been loaded before calling this function. See n_infos() to find the maximum number of entries.

§namespace_

Namespace to inspect

§index

0-based offset into namespace metadata for entry

§Returns

BaseInfo containing metadata

Source

fn loaded_namespaces(&self) -> Vec<GString>

Return the list of currently loaded namespaces.

§Returns

List of namespaces

Source

fn n_infos(&self, namespace_: &str) -> i32

This function returns the number of metadata entries in given namespace namespace_. The namespace must have already been loaded before calling this function.

§namespace_

Namespace to inspect

§Returns

number of metadata entries

Source

fn object_gtype_interfaces(&self, gtype: Type) -> Vec<InterfaceInfo>

Look up the implemented interfaces for gtype. This function cannot fail per se; but for a totally “unknown” GType, it may return 0 implemented interfaces.

The semantics of this function are designed for a dynamic binding, where in certain cases (such as a function which returns an interface which may have “hidden” implementation classes), not all data may be statically known, and will have to be determined from the GType of the object. An example is g_file_new_for_path() returning a concrete class of GLocalFile, which is a GType we see at runtime, but not statically.

§gtype

a GType whose fundamental type is G_TYPE_OBJECT

§Returns
§interfaces_out

Interfaces for gtype

Source

fn shared_library(&self, namespace_: &str) -> Option<GString>

This function returns a comma-separated list of paths to the shared C libraries associated with the given namespace namespace_. There may be no shared library path associated, in which case this function will return None.

Note: The namespace must have already been loaded using a function such as require() before calling this function.

§namespace_

Namespace to inspect

§Returns

Comma-separated list of paths to shared libraries, or None if none are associated

Source

fn typelib_path(&self, namespace_: &str) -> Option<GString>

If namespace namespace_ is loaded, return the full path to the .typelib file it was loaded from. If the typelib for namespace namespace_ was included in a shared library, return the special string “<builtin>”.

§namespace_

GI namespace to use, e.g. “Gtk”

§Returns

Filesystem path (or $lt;builtin$gt;) if successful, None if namespace is not loaded

Source

fn version(&self, namespace_: &str) -> Option<GString>

This function returns the loaded version associated with the given namespace namespace_.

Note: The namespace must have already been loaded using a function such as require() before calling this function.

§namespace_

Namespace to inspect

§Returns

Loaded version

Source

fn is_registered(&self, namespace_: &str, version: Option<&str>) -> bool

Check whether a particular namespace (and optionally, a specific version thereof) is currently loaded. This function is likely to only be useful in unusual circumstances; in order to act upon metadata in the namespace, you should call require() instead which will ensure the namespace is loaded, and return as quickly as this function will if it has already been loaded.

§namespace_

Namespace of interest

§version

Required version, may be None for latest

§Returns

true if namespace-version is loaded, false otherwise

Source

fn load_typelib( &self, typelib: &mut Typelib, flags: RepositoryLoadFlags, ) -> Result<GString, Error>

TODO

§typelib

TODO

§flags

TODO

Source

fn require( &self, namespace_: &str, version: Option<&str>, flags: RepositoryLoadFlags, ) -> Result<Typelib, Error>

Force the namespace namespace_ to be loaded if it isn’t already. If namespace_ is not loaded, this function will search for a “.typelib” file using the repository search path. In addition, a version version of namespace may be specified. If version is not specified, the latest will be used.

§namespace_

GI namespace to use, e.g. “Gtk”

§version

Version of namespace, may be None for latest

§flags

Set of GIRepositoryLoadFlags, may be 0

§Returns

a pointer to the Typelib if successful, None otherwise

Source

fn require_private( &self, typelib_dir: &str, namespace_: &str, version: Option<&str>, flags: RepositoryLoadFlags, ) -> Result<Typelib, Error>

Force the namespace namespace_ to be loaded if it isn’t already. If namespace_ is not loaded, this function will search for a “.typelib” file within the private directory only. In addition, a version version of namespace should be specified. If version is not specified, the latest will be used.

§typelib_dir

Private directory where to find the requested typelib

§namespace_

GI namespace to use, e.g. “Gtk”

§version

Version of namespace, may be None for latest

§flags

Set of GIRepositoryLoadFlags, may be 0

§Returns

a pointer to the Typelib if successful, None otherwise

Implementors§