alith_client/primitives/
mod.rs

1pub mod boolean;
2pub mod exact_string;
3pub mod integer;
4pub mod sentences;
5pub mod text;
6pub mod text_list;
7pub mod words;
8
9use crate::components::grammar::Grammar;
10use anyhow::Result;
11pub use boolean::BooleanPrimitive;
12pub use exact_string::ExactStringPrimitive;
13pub use integer::IntegerPrimitive;
14pub use sentences::SentencesPrimitive;
15pub use text::TextPrimitive;
16pub use text_list::TextListPrimitive;
17pub use words::WordsPrimitive;
18
19pub trait PrimitiveTrait: Default {
20    type PrimitiveResult: std::fmt::Display;
21
22    fn clear_primitive(&mut self);
23
24    fn type_description(&self, result_can_be_none: bool) -> &str;
25
26    fn solution_description(&self, result_can_be_none: bool) -> String;
27
28    fn stop_word_result_is_none(&self, result_can_be_none: bool) -> Option<String>;
29
30    fn grammar(&self) -> Grammar;
31
32    fn parse_to_primitive(&self, content: &str) -> Result<Self::PrimitiveResult>;
33}