Struct dygpi::config::PluginManagerConfiguration[][src]

pub struct PluginManagerConfiguration { /* fields omitted */ }
Expand description

The plugin manager configuration itself. This is logically a map from a plugin type identifier and a list of library paths. The type identifier allows the configuration to partition the list of libraries so that multiple plugin managers may be created, for different plugin types, from the same configuration value or serialized file.

Note, that if the feature “config_serde” is included this type implements the Serde Deserialize and Serialize traits and so may be included in configuration files.

use dygpi::config::PluginManagerConfiguration;
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize)]
pub struct MyAppConfiguration {
    pub save_path: String,
    pub template_path: String,
    pub plugins: Option<PluginManagerConfiguration>,
}

Implementations

Returns true if the configuration contains no plugin types, else false.

Returns the number of plugin types in the configuration, also referred to as its ‘length’.

Return an iterator over the plugin type identifiers in the configuration.

Returns true if the configuration has values for the provided plugin type identifier, else false.

Returns an iterator over all the library paths specified for the provided plugin type identifier. This method returns None if the configuration has no entry for the plugin type.

Insert a list of libraries for the named plugin type; if there exists an entry for this type already it will be replaced. Note that this method will panic if the library list is empty.

Merge a list of libraries into the configuration for the plugin type. if there exists an entry for this type already the values provided will be added to the list, if not then this acts exactly as insert. Note that this method will panic if the library list is empty.

Removes and returns the plugin libraries for the plugin type.

Construct and return a new PluginManager for plugins of type T using the list of libraries specified for the plugin type identifier provided. Note that this method will return an error if there is no configured library list for the provided plugin type.

Example

use dygpi::config::PluginManagerConfiguration;
use dygpi::manager::PluginManager;

let config_as_string = read_config_file();
let config: PluginManagerConfiguration = toml::from_str(&config_as_string).unwrap();
let manager: PluginManager<SoundEffectPlugin> =
    config.make_manager_for_type("sound_effects")
        .unwrap();

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.