Trait amethyst_config::Element [] [src]

pub trait Element: Sized {
    fn from_yaml(_: &ConfigMeta, _: &Yaml) -> Result<Self, ConfigError>;
    fn to_yaml(&self, _: &Path) -> Yaml;

    fn set_meta(&mut self, &ConfigMeta) { ... }
    fn meta(&self) -> Option<ConfigMeta> { ... }
    fn from_string(src: &str) -> Result<Self, ConfigError> { ... }
    fn from_file_raw<P: AsRef<Path>>(
        meta: &ConfigMeta,
        path: P
    ) -> Result<Self, ConfigError> { ... } fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, ConfigError> { ... } fn write_file(&self) -> Result<(), ConfigError> { ... } }

Trait for fields inside of a configuration struct.

Required Methods

Convert yaml element into a rust type, Raises an error if it is not the yaml element expected

Converts rust type into a yaml element for writing Requires the path for external configs

Provided Methods

Sets the meta data of a config structure, only works on config structures

Returns meta data if it is a config structure

From some string (should be used for top level elements if you want to embed the code)

From a file relative to current config

From a file relative to project

Recursively writes to files given the configuration's current context.

The default path for a root configuration file is "config/config.yml".

Note: This should never be called on a non-config! defined structure.

Implementors