CustomGenerator

Trait CustomGenerator 

Source
pub trait CustomGenerator: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn generate(&self) -> Result<Value>;

    // Provided methods
    fn generate_with_params(
        &self,
        params: &HashMap<String, Value>,
    ) -> Result<Value> { ... }
    fn validate_params(&self, params: &HashMap<String, Value>) -> Result<()> { ... }
    fn param_schema(&self) -> HashMap<String, ParamType> { ... }
}
Expand description

自定义生成器特征

Required Methods§

Source

fn name(&self) -> &str

生成器名称

Source

fn description(&self) -> &str

生成器描述

Source

fn generate(&self) -> Result<Value>

生成数据

Provided Methods§

Source

fn generate_with_params(&self, params: &HashMap<String, Value>) -> Result<Value>

生成带参数的数据

Source

fn validate_params(&self, params: &HashMap<String, Value>) -> Result<()>

验证参数

Source

fn param_schema(&self) -> HashMap<String, ParamType>

获取参数模式

Implementors§