pub struct Verifier {
pub commands: HashMap<String, Vec<Command>>,
}Expand description
Converts a ParsedCommand to a VerifiedCommand by performing validation and type casting on values.
let grammar = Verifier::former()
.command
(
Command::former()
.hint( "hint" )
.long_hint( "long_hint" )
.phrase( "command" )
.form()
)
.form();
let raw_command = ParsedCommand
{
name: "command".to_string(),
subjects: vec![],
properties: HashMap::new(),
};
let grammar_command = grammar.to_command( raw_command )?;Fields§
§commands: HashMap<String, Vec<Command>>all available commands
Implementations§
source§impl Verifier
impl Verifier
sourcepub fn former() -> VerifierFormer<Verifier, ReturnContainer>
pub fn former() -> VerifierFormer<Verifier, ReturnContainer>
Make former, variation of builder pattern to form structure defining values of fields step by step.
source§impl Verifier
impl Verifier
sourcepub fn to_program(
&self,
raw_program: Program<Namespace<ParsedCommand>>
) -> Result<Program<Namespace<VerifiedCommand>>>
pub fn to_program( &self, raw_program: Program<Namespace<ParsedCommand>> ) -> Result<Program<Namespace<VerifiedCommand>>>
Converts raw program to grammatically correct
Converts all namespaces into it with to_namespace method.
sourcepub fn to_namespace(
&self,
raw_namespace: Namespace<ParsedCommand>
) -> Result<Namespace<VerifiedCommand>>
pub fn to_namespace( &self, raw_namespace: Namespace<ParsedCommand> ) -> Result<Namespace<VerifiedCommand>>
Converts raw namespace to grammatically correct
Converts all commands into it with to_command method.
sourcepub fn to_command(&self, raw_command: ParsedCommand) -> Result<VerifiedCommand>
pub fn to_command(&self, raw_command: ParsedCommand) -> Result<VerifiedCommand>
Converts raw command to grammatically correct
Make sure that this command is described in the grammar and matches it(command itself and all it options too).
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Verifier
impl Send for Verifier
impl Sync for Verifier
impl Unpin for Verifier
impl UnwindSafe for Verifier
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more