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
fn from_yaml(_: &ConfigMeta, _: &Yaml) -> Result<Self, ConfigError>
Convert yaml element into a rust type, Raises an error if it is not the yaml element expected
fn to_yaml(&self, _: &Path) -> Yaml
Converts rust type into a yaml element for writing Requires the path for external configs
Provided Methods
fn set_meta(&mut self, &ConfigMeta)
Sets the meta data of a config structure, only works on config structures
fn meta(&self) -> Option<ConfigMeta>
Returns meta data if it is a config structure
fn from_string(src: &str) -> Result<Self, ConfigError>
From some string (should be used for top level elements if you want to embed the code)
fn from_file_raw<P: AsRef<Path>>(
meta: &ConfigMeta,
path: P
) -> Result<Self, ConfigError>
meta: &ConfigMeta,
path: P
) -> Result<Self, ConfigError>
From a file relative to current config
fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, ConfigError>
From a file relative to project
fn write_file(&self) -> Result<(), ConfigError>
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
impl Element for i8
impl Element for i16
impl Element for i32
impl Element for i64
impl Element for u8
impl Element for u16
impl Element for u32
impl Element for u64
impl Element for f32
impl Element for f64
impl Element for bool
impl Element for String
impl Element for ()
impl<A: Element> Element for (A,)
impl<A: Element, B: Element> Element for (A, B)
impl<A: Element, B: Element, C: Element> Element for (A, B, C)
impl<A: Element, B: Element, C: Element, D: Element> Element for (A, B, C, D)
impl<A: Element, B: Element, C: Element, D: Element, E: Element> Element for (A, B, C, D, E)
impl<A: Element, B: Element, C: Element, D: Element, E: Element, F: Element> Element for (A, B, C, D, E, F)
impl<A: Element, B: Element, C: Element, D: Element, E: Element, F: Element, G: Element> Element for (A, B, C, D, E, F, G)
impl<A: Element, B: Element, C: Element, D: Element, E: Element, F: Element, G: Element, H: Element> Element for (A, B, C, D, E, F, G, H)
impl<A: Element, B: Element, C: Element, D: Element, E: Element, F: Element, G: Element, H: Element, I: Element> Element for (A, B, C, D, E, F, G, H, I)
impl<A: Element, B: Element, C: Element, D: Element, E: Element, F: Element, G: Element, H: Element, I: Element, J: Element> Element for (A, B, C, D, E, F, G, H, I, J)
impl<T: Element> Element for Option<T>
impl<T: Element> Element for [T; 1]
impl<T: Element> Element for [T; 2]
impl<T: Element> Element for [T; 3]
impl<T: Element> Element for [T; 4]
impl<T: Element> Element for [T; 5]
impl<T: Element> Element for [T; 6]
impl<T: Element> Element for [T; 7]
impl<T: Element> Element for [T; 8]
impl<T: Element> Element for [T; 9]
impl<T: Element> Element for [T; 10]
impl<T: Element> Element for Vec<T>
impl<K: Element + Hash + Eq, V: Element> Element for HashMap<K, V>
impl<K: Element + Ord, V: Element> Element for BTreeMap<K, V>
impl<T: Element + Hash + Eq> Element for HashSet<T>
impl<T: Element + Ord> Element for BTreeSet<T>
impl Element for DisplayConfig
impl Element for LoggingConfig
impl Element for Config