pub trait PoolExt:
IsA<Pool>
+ Sealed
+ 'static {
Show 26 methods
// Provided methods
fn add_components(&self, cbox: &impl IsA<ComponentBox>) -> Result<(), Error> { ... }
fn add_extra_data_location(
&self,
directory: &str,
format_style: FormatStyle,
) { ... }
fn add_flags(&self, flags: PoolFlags) { ... }
fn build_search_tokens(&self, search: &str) -> Vec<GString> { ... }
fn clear(&self) { ... }
fn components(&self) -> Option<ComponentBox> { ... }
fn components_by_bundle_id(
&self,
kind: BundleKind,
bundle_id: &str,
match_prefix: bool,
) -> Option<ComponentBox> { ... }
fn components_by_categories(
&self,
categories: &[&str],
) -> Option<ComponentBox> { ... }
fn components_by_extends(&self, extended_id: &str) -> Option<ComponentBox> { ... }
fn components_by_id(&self, cid: &str) -> Option<ComponentBox> { ... }
fn components_by_kind(&self, kind: ComponentKind) -> Option<ComponentBox> { ... }
fn components_by_launchable(
&self,
kind: LaunchableKind,
id: &str,
) -> Option<ComponentBox> { ... }
fn components_by_provided_item(
&self,
kind: ProvidedKind,
item: &str,
) -> Option<ComponentBox> { ... }
fn flags(&self) -> PoolFlags { ... }
fn locale(&self) -> Option<GString> { ... }
fn is_empty(&self) -> bool { ... }
fn load(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error> { ... }
fn load_async<P: FnOnce(Result<(), Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
) { ... }
fn load_future(
&self,
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... }
fn remove_flags(&self, flags: PoolFlags) { ... }
fn reset_extra_data_locations(&self) { ... }
fn search(&self, search: &str) -> Option<ComponentBox> { ... }
fn set_flags(&self, flags: PoolFlags) { ... }
fn set_load_std_data_locations(&self, enabled: bool) { ... }
fn set_locale(&self, locale: &str) { ... }
fn connect_changed<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Provided Methods§
sourcefn add_components(&self, cbox: &impl IsA<ComponentBox>) -> Result<(), Error>
fn add_components(&self, cbox: &impl IsA<ComponentBox>) -> Result<(), Error>
sourcefn add_extra_data_location(&self, directory: &str, format_style: FormatStyle)
fn add_extra_data_location(&self, directory: &str, format_style: FormatStyle)
Add an additional non-standard location to the metadata pool where metadata will be read from.
If directory
contains a “xml”, “xmls”, “yaml” or “icons” subdirectory (or all of them),
those paths will be added to the search paths instead.
§directory
An existing filesystem location.
§format_style
The expected format style of the metadata, e.g. FormatStyle::Catalog
sourcefn build_search_tokens(&self, search: &str) -> Vec<GString>
fn build_search_tokens(&self, search: &str) -> Vec<GString>
Splits up a string into an array of tokens that are suitable for searching. This includes stripping whitespaces, casefolding the terms and removing greylist words.
This function is usually called automatically when needed, you will only need to run it explicitly when you need to check which search tokens the pool will actually use internally for a given phrase.
§search
the (user-provided) search phrase.
§Returns
(array zero-terminated=1): Valid tokens to search for, or None
for error
sourcefn clear(&self)
fn clear(&self)
Remove all metadata from the pool, data will be reloaded
once as_pool_load
is called again.
sourcefn components(&self) -> Option<ComponentBox>
fn components(&self) -> Option<ComponentBox>
sourcefn components_by_bundle_id(
&self,
kind: BundleKind,
bundle_id: &str,
match_prefix: bool,
) -> Option<ComponentBox>
fn components_by_bundle_id( &self, kind: BundleKind, bundle_id: &str, match_prefix: bool, ) -> Option<ComponentBox>
Find components that are provided by a bundle with a specific ID by its prefix. For example, given a AS_BUNDLE_KIND_FLATPAK and a bundle_id “org.kde.dolphin/”, it will list all the components that bundle dolphin. If the bundle_id is “org.kde.dolphin/x86_64” it will give those with also the architecture.
§kind
The kind of the bundle we are looking for
§bundle_id
The bundle ID to match, as specified in Bundle
§match_prefix
true
to match the ID by prefix, false
to perform an absolute match.
§Returns
an ComponentBox
.
sourcefn components_by_categories(&self, categories: &[&str]) -> Option<ComponentBox>
fn components_by_categories(&self, categories: &[&str]) -> Option<ComponentBox>
Return a list of components which are in all of the categories.
§categories
An array of XDG categories to include.
§Returns
an ComponentBox
of found components.
sourcefn components_by_extends(&self, extended_id: &str) -> Option<ComponentBox>
fn components_by_extends(&self, extended_id: &str) -> Option<ComponentBox>
Find components extending the component with the given ID. They can then be registered to the
Component
they extend via as_component_add_addon
.
If the PoolFlags::RESOLVE_ADDONS
pool flag is set, addons are automatically resolved and
this explicit function is not needed, but overall query time will be increased (so only use
this flag if you will be resolving addon information later anyway).
§extended_id
The ID of the component to search extensions for.
§Returns
an ComponentBox
.
sourcefn components_by_id(&self, cid: &str) -> Option<ComponentBox>
fn components_by_id(&self, cid: &str) -> Option<ComponentBox>
Get a specific component by its ID. This function may contain multiple results if we have data describing this component from multiple scopes/origin types.
§cid
The AppStream-ID to look for.
§Returns
an ComponentBox
.
sourcefn components_by_kind(&self, kind: ComponentKind) -> Option<ComponentBox>
fn components_by_kind(&self, kind: ComponentKind) -> Option<ComponentBox>
Return a list of all components in the pool which are of a certain kind.
§kind
An ComponentKind
.
§Returns
an ComponentBox
of found components.
sourcefn components_by_launchable(
&self,
kind: LaunchableKind,
id: &str,
) -> Option<ComponentBox>
fn components_by_launchable( &self, kind: LaunchableKind, id: &str, ) -> Option<ComponentBox>
Find components in the AppStream data pool which provide a specific launchable.
See Launchable
for details on launchables, or refer to the AppStream specification.
§kind
§id
The ID of the launchable.
§Returns
an ComponentBox
of found components.
sourcefn components_by_provided_item(
&self,
kind: ProvidedKind,
item: &str,
) -> Option<ComponentBox>
fn components_by_provided_item( &self, kind: ProvidedKind, item: &str, ) -> Option<ComponentBox>
Find components in the AppStream data pool which provide a certain item.
§kind
An AsProvidesKind
§item
The value of the provided item.
§Returns
an ComponentBox
of found components.
sourcefn load(&self, cancellable: Option<&impl IsA<Cancellable>>) -> Result<(), Error>
fn load(&self, cancellable: Option<&impl IsA<Cancellable>>) -> Result<(), Error>
Builds an index of all found components in the watched locations.
The function will try to get as much data into the pool as possible, so even if
the update completes with false
, it might still have added components to the pool.
The function will load from all possible data sources, preferring caches if they are up to date.
§cancellable
§Returns
true
if update completed without error.
sourcefn load_async<P: FnOnce(Result<(), Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn load_async<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
fn load_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
sourcefn remove_flags(&self, flags: PoolFlags)
fn remove_flags(&self, flags: PoolFlags)
sourcefn reset_extra_data_locations(&self)
fn reset_extra_data_locations(&self)
Remove all explicitly added metadata locations.
sourcefn search(&self, search: &str) -> Option<ComponentBox>
fn search(&self, search: &str) -> Option<ComponentBox>
Search for a list of components matching the search term. The list will be ordered by match score.
§search
A search string
§Returns
an ComponentBox
of the found components.
sourcefn set_load_std_data_locations(&self, enabled: bool)
fn set_load_std_data_locations(&self, enabled: bool)
This is a convenience function that enables or disables loading of metadata
from well-known standard locations by configuring the PoolFlags
of this
Pool
accordingly.
Data affected by this includes the OS data catalog, metainfo, desktop-entry
files and Flatpak data.
If you need more fine-grained control, set the PoolFlags
explicitly.
§enabled
Whether loading of data from standard locations should be enabled.
sourcefn set_locale(&self, locale: &str)
fn set_locale(&self, locale: &str)
Sets the current locale which should be used when parsing metadata.
§locale
the BCP47 or POSIX locale to use for this pool.
sourcefn connect_changed<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_changed<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId
The ::changed signal is emitted when components have been added or removed from the metadata pool.