pub trait ActionStrategy: Send + Sync {
// Required methods
fn can_handle(&self, key: &str) -> bool;
fn validate(
&self,
key: &str,
_value: &Value,
config: &EspforgeConfiguration,
manifests: &HashMap<String, ComponentManifest>,
) -> ValidationResult;
fn render(
&self,
key: &str,
value: &Value,
config: &EspforgeConfiguration,
manifests: &HashMap<String, ComponentManifest>,
tera: &mut Tera,
) -> Result<String>;
}Expand description
Trait Definition (Design Pattern: Strategy)
Required Methods§
Sourcefn can_handle(&self, key: &str) -> bool
fn can_handle(&self, key: &str) -> bool
Returns true if this strategy claims responsibility for this action key.
Sourcefn validate(
&self,
key: &str,
_value: &Value,
config: &EspforgeConfiguration,
manifests: &HashMap<String, ComponentManifest>,
) -> ValidationResult
fn validate( &self, key: &str, _value: &Value, config: &EspforgeConfiguration, manifests: &HashMap<String, ComponentManifest>, ) -> ValidationResult
Validates the action logic (e.g. does the component exist? does the method exist?). This is used by the AppNibbler.