Struct wca::ExecutorConverter
source · pub struct ExecutorConverter { /* private fields */ }Expand description
This is the struct that provides a way to convert a VerifiedCommand to an ExecutableCommand_.
The conversion is done by looking up the Routine associated with the command in a HashMap of routines.
let executor_converter = ExecutorConverter::former()
.routine( "command", Routine::new( |( args, props )| Ok( () ) ) )
.form();
let grammar_command = VerifiedCommand
{
phrase : "command".to_string(),
subjects : vec![],
properties : HashMap::new(),
};
let executable_command = executor_converter.to_command( grammar_command )?;Implementations§
source§impl ExecutorConverter
impl ExecutorConverter
sourcepub fn former() -> ExecutorConverterFormer<ExecutorConverter, ReturnContainer>
pub fn former() -> ExecutorConverterFormer<ExecutorConverter, ReturnContainer>
Make former, variation of builder pattern to form structure defining values of fields step by step.
source§impl ExecutorConverter
impl ExecutorConverter
sourcepub fn to_program(
&self,
raw_program: Program<Namespace<VerifiedCommand>>
) -> Result<Program<Namespace<ExecutableCommand_>>>
pub fn to_program( &self, raw_program: Program<Namespace<VerifiedCommand>> ) -> Result<Program<Namespace<ExecutableCommand_>>>
Converts raw program to executable
sourcepub fn to_namespace(
&self,
raw_namespace: Namespace<VerifiedCommand>
) -> Result<Namespace<ExecutableCommand_>>
pub fn to_namespace( &self, raw_namespace: Namespace<VerifiedCommand> ) -> Result<Namespace<ExecutableCommand_>>
Converts raw namespace to executable
sourcepub fn to_command(&self, command: VerifiedCommand) -> Result<ExecutableCommand_>
pub fn to_command(&self, command: VerifiedCommand) -> Result<ExecutableCommand_>
Converts raw command to executable
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ExecutorConverter
impl !Send for ExecutorConverter
impl !Sync for ExecutorConverter
impl Unpin for ExecutorConverter
impl !UnwindSafe for ExecutorConverter
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