Trait dotfiles_core::action::ActionParser

source ·
pub trait ActionParser<'a>: HasDirectiveData<'a> {
    type ActionType: Action<'a>;

    // Required method
    fn parse_action(
        &'a self,
        settings: &Settings,
        yaml: &StrictYaml,
        current_dir: &Path
    ) -> Result<Self::ActionType, DotfilesError>;

    // Provided method
    fn parse_action_list(
        &'a self,
        settings: &Settings,
        yaml: &StrictYaml,
        current_dir: &Path
    ) -> Result<Vec<Self::ActionType>, DotfilesError> { ... }
}
Expand description

Trait to parse a specific action type from StrictYaml.

Required Associated Types§

source

type ActionType: Action<'a>

The action type this object parses

Required Methods§

source

fn parse_action( &'a self, settings: &Settings, yaml: &StrictYaml, current_dir: &Path ) -> Result<Self::ActionType, DotfilesError>

Builds a single action of type ActionParser::ActionType from StrictYaml tree object that represents the action’s configuration and a default settings object.

Returns an Error containing a human readable string in case there was an issue building the action.

Provided Methods§

source

fn parse_action_list( &'a self, settings: &Settings, yaml: &StrictYaml, current_dir: &Path ) -> Result<Vec<Self::ActionType>, DotfilesError>

Builds a list of actions of type ActionParser::ActionType from StrictYaml tree object that represents the actions’ configurations and a default settings object.

Returns an Error containing a human readable string in case there was an issue building the action.

The default implementation assumes there must be StrictYaml array whose items each represent an individual action

Implementors§