pub trait Module:
Send
+ Sync
+ Debug {
// Required methods
fn get_name(&self) -> &str;
fn exec(
&self,
global_params: &GlobalParams<'_>,
params: YamlValue,
vars: &Value,
check_mode: bool,
) -> Result<(ModuleResult, Option<Value>)>;
// Provided method
fn force_string_on_params(&self) -> bool { ... }
}
Required Methods§
Sourcefn exec(
&self,
global_params: &GlobalParams<'_>,
params: YamlValue,
vars: &Value,
check_mode: bool,
) -> Result<(ModuleResult, Option<Value>)>
fn exec( &self, global_params: &GlobalParams<'_>, params: YamlValue, vars: &Value, check_mode: bool, ) -> Result<(ModuleResult, Option<Value>)>
Executes the module’s functionality with the provided parameters.
This method is responsible for performing the module’s core logic. It accepts a set of YAML parameters and additional variables, then runs the module’s functionality. The result includes both the outcome of the execution and any potential changes made to the variables.
Provided Methods§
Sourcefn force_string_on_params(&self) -> bool
fn force_string_on_params(&self) -> bool
Determines if the module requires its parameters to be treated as strings.
By default, this returns true
, meaning the module will force all parameters
to be interpreted as strings. Override this method if the module should
accept other types.