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
Required Methods§
Sourcefn enumerate_versions(&self, namespace_: &str) -> Vec<GString>
fn enumerate_versions(&self, namespace_: &str) -> Vec<GString>
Sourcefn find_by_error_domain(&self, domain: Quark) -> Option<EnumInfo>
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
Sourcefn find_by_gtype(&self, gtype: Type) -> Option<BaseInfo>
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
Sourcefn find_by_name(&self, namespace_: &str, name: &str) -> Option<BaseInfo>
fn find_by_name(&self, namespace_: &str, name: &str) -> Option<BaseInfo>
Sourcefn c_prefix(&self, namespace_: &str) -> Option<GString>
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
Sourcefn dependencies(&self, namespace_: &str) -> Vec<GString>
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
Sourcefn immediate_dependencies(&self, namespace_: &str) -> Vec<GString>
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
Sourcefn info(&self, namespace_: &str, index: i32) -> Option<BaseInfo>
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
Sourcefn loaded_namespaces(&self) -> Vec<GString>
fn loaded_namespaces(&self) -> Vec<GString>
Sourcefn object_gtype_interfaces(&self, gtype: Type) -> Vec<InterfaceInfo> ⓘ
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
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
Sourcefn typelib_path(&self, namespace_: &str) -> Option<GString>
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
Sourcefn is_registered(&self, namespace_: &str, version: Option<&str>) -> bool
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
Sourcefn load_typelib(
&self,
typelib: &mut Typelib,
flags: RepositoryLoadFlags,
) -> Result<GString, Error>
fn load_typelib( &self, typelib: &mut Typelib, flags: RepositoryLoadFlags, ) -> Result<GString, Error>
Sourcefn require(
&self,
namespace_: &str,
version: Option<&str>,
flags: RepositoryLoadFlags,
) -> Result<Typelib, Error>
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
Sourcefn require_private(
&self,
typelib_dir: &str,
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>
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