pub struct Program<Namespace> {
pub namespaces: Vec<Namespace>,
}Expand description
Represents a program that contains one or more namespaces, where each namespace contains a list of commands.
A Program consists of one or more Namespaces, where each namespace contains a list of commands. The Namespace can be any type that represents a namespace of commands, such as RawCommand, GrammarCommand, or ExecutableCommand.
The program can be executed by iterating over each namespace and executing its commands sequentially or in parallel.
Example:
let namespace1 = Namespace
{
commands : vec!
[
RawCommand
{
name : "cmd1".to_string(),
subjects : vec![ "sub1".to_string() ],
properties: HashMap::new(),
},
RawCommand
{
name: "cmd2".to_string(),
subjects: vec![ "sub2".to_string(), "sub3".to_string() ],
properties: HashMap::new(),
},
],
};
let namespace2 = Namespace
{
commands : vec!
[
RawCommand
{
name : "cmd1".to_string(),
subjects : vec![ "sub1".to_string() ],
properties: HashMap::new(),
},
],
};
let program = Program { namespaces : vec![ namespace1, namespace2, /* ... */ ] };In the above example, a Program is created with two Namespace objects. Each namespace contains a different set of RawCommand objects with different sets of subjects. The Program can be executed by iterating over each namespace and executing its commands in sequence.
Fields§
§namespaces: Vec<Namespace>list of namespaces with commands
Trait Implementations§
source§impl<Namespace: PartialEq> PartialEq for Program<Namespace>
impl<Namespace: PartialEq> PartialEq for Program<Namespace>
impl<Namespace: Eq> Eq for Program<Namespace>
impl<Namespace> StructuralEq for Program<Namespace>
impl<Namespace> StructuralPartialEq for Program<Namespace>
Auto Trait Implementations§
impl<Namespace> RefUnwindSafe for Program<Namespace>where
Namespace: RefUnwindSafe,
impl<Namespace> Send for Program<Namespace>where
Namespace: Send,
impl<Namespace> Sync for Program<Namespace>where
Namespace: Sync,
impl<Namespace> Unpin for Program<Namespace>where
Namespace: Unpin,
impl<Namespace> UnwindSafe for Program<Namespace>where
Namespace: UnwindSafe,
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