Struct wca::CommandsAggregator
source · pub struct CommandsAggregator { /* private fields */ }Expand description
The CommandsAggregator struct is responsible for aggregating all commands that the user defines,
and for parsing and executing them. It is the main entry point of the library.
CommandsAggregator component brings everything together. This component is responsible for configuring the Parser, Grammar, and Executor components based on the user’s needs. It also manages the entire pipeline of processing, from parsing the raw text input to executing the final command(parse -> validate -> execute).
Example:
use wca::prelude::*;
let ca = CommandsAggregator::former()
.grammar(
[
Command::former()
.phrase( "echo" )
.hint( "prints all subjects and properties" )
.subject( "Subject", Type::String, false )
.property( "property", "simple property", Type::String, false )
.form(),
])
.executor(
[
( "echo".to_owned(), Routine::new( |( args, props )|
{
println!( "= Args\n{args:?}\n\n= Properties\n{props:?}\n" );
Ok( () )
})),
])
.build();
ca.perform( ".echo something" )?;Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CommandsAggregator
impl !Send for CommandsAggregator
impl !Sync for CommandsAggregator
impl Unpin for CommandsAggregator
impl !UnwindSafe for CommandsAggregator
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