Skip to main content

ActionParser

Trait 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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§