pub struct Verifier;Expand description
Converts a ParsedCommand to a VerifiedCommand by performing validation and type casting on values.
let dictionary = Dictionary::former()
.command( Command::former().phrase( "command" ).form() )
.form();
let raw_command = ParsedCommand
{
name: "command".to_string(),
subjects: vec![],
properties: HashMap::new(),
};
let grammar_command = verifier.to_command( &dictionary, raw_command )?;Implementations§
source§impl Verifier
impl Verifier
sourcepub fn to_program(
&self,
dictionary: &Dictionary,
raw_program: Program<ParsedCommand>
) -> Result<Program<VerifiedCommand>>
pub fn to_program( &self, dictionary: &Dictionary, raw_program: Program<ParsedCommand> ) -> Result<Program<VerifiedCommand>>
Converts raw program to grammatically correct
Converts all namespaces into it with to_namespace method.
sourcepub fn to_command(
&self,
dictionary: &Dictionary,
raw_command: ParsedCommand
) -> Result<VerifiedCommand>
pub fn to_command( &self, dictionary: &Dictionary, 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 Freeze for Verifier
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
source§impl<S> SetWithType for S
impl<S> SetWithType for S
source§fn set_with_type<T, IntoT>(&mut self, component: IntoT)where
IntoT: Into<T>,
S: SetComponent<T, IntoT>,
fn set_with_type<T, IntoT>(&mut self, component: IntoT)where
IntoT: Into<T>,
S: SetComponent<T, IntoT>,
Function to set value of a component by its type.