MessageLoader

Trait MessageLoader 

Source
pub trait MessageLoader: Sized {
    type Value;
    type NestValue;

    const EXTENSION: &'static str;
    const NEST_VALUE_NAME: &'static str;

    // Required methods
    fn value_to_nest(value: Self::Value) -> Option<Self::NestValue>;
    fn value_as_str(value: &Self::Value) -> Option<&str>;
    fn value_from_str(content: &str) -> Result<Self::Value, String>;
    fn iter_nested(
        value: Self::NestValue,
    ) -> impl Iterator<Item = (String, Self::Value)>;

    // Provided methods
    fn from_path(path: ArgPath) -> Vec<LangMessage> { ... }
    fn from_file(file: PathBuf) -> Vec<LangMessage> { ... }
    fn from_folder(folder: PathBuf) -> Vec<LangMessage> { ... }
    fn internal(
        lang: &str,
        hierarchy: &mut Hierarchy<String>,
        value: Self::NestValue,
    ) -> Vec<Message> { ... }
}

Required Associated Constants§

Source

const EXTENSION: &'static str

Source

const NEST_VALUE_NAME: &'static str

Required Associated Types§

Required Methods§

Source

fn value_to_nest(value: Self::Value) -> Option<Self::NestValue>

Source

fn value_as_str(value: &Self::Value) -> Option<&str>

Source

fn value_from_str(content: &str) -> Result<Self::Value, String>

Source

fn iter_nested( value: Self::NestValue, ) -> impl Iterator<Item = (String, Self::Value)>

Provided Methods§

Source

fn from_path(path: ArgPath) -> Vec<LangMessage>

Source

fn from_file(file: PathBuf) -> Vec<LangMessage>

Source

fn from_folder(folder: PathBuf) -> Vec<LangMessage>

Source

fn internal( lang: &str, hierarchy: &mut Hierarchy<String>, value: Self::NestValue, ) -> Vec<Message>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§