Skip to main content

AiQuestion

Trait AiQuestion 

Source
trait AiQuestion:
    Debug
    + Eq
    + Hash
    + Send
    + Sync
    + 'static {
    type Criteria: Serialize + Send + Sync;

    const NAME: &'static str;
    const TYPE: &'static str;
    const ARG_COUNT: usize;

    // Required methods
    fn return_type() -> DataType;
    fn parse_criteria(args: &[&str]) -> Result<Self::Criteria>;
    fn parse_answer(
        answer: &Value,
        criteria: &Self::Criteria,
    ) -> Result<ScalarValue>;
}
Expand description

The request criteria and scalar answer contract for an AI question type.

Required Associated Constants§

Source

const NAME: &'static str

Source

const TYPE: &'static str

Source

const ARG_COUNT: usize

Required Associated Types§

Required Methods§

Source

fn return_type() -> DataType

Source

fn parse_criteria(args: &[&str]) -> Result<Self::Criteria>

Source

fn parse_answer( answer: &Value, criteria: &Self::Criteria, ) -> Result<ScalarValue>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl AiQuestion for Choice

Source§

const NAME: &'static str = "ai_choose"

Source§

const TYPE: &'static str = "choice"

Source§

const ARG_COUNT: usize = 3

Source§

type Criteria = Map<String, Value>

Source§

impl AiQuestion for Noul

Source§

const NAME: &'static str = "ai_match"

Source§

const TYPE: &'static str = "noul"

Source§

const ARG_COUNT: usize = 2

Source§

type Criteria = ()

Source§

impl AiQuestion for Score

Source§

const NAME: &'static str = "ai_score"

Source§

const TYPE: &'static str = "score"

Source§

const ARG_COUNT: usize = 3

Source§

type Criteria = Vec<Value>