diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-10-13 12:36:45 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-10-13 12:36:45 +0200 |
| commit | e2d17aa9d9491b339e6200c97b52f7ade51fa1d8 (patch) | |
| tree | 95dfa729cc6cbe44ecbf5135f87a3dd8bb70200a /src/func.rs | |
| parent | 463e4ebd8234da5e28700e9b22b6ef5f0dfef56f (diff) | |
Move functions to command-based architecture ✈
Diffstat (limited to 'src/func.rs')
| -rw-r--r-- | src/func.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/func.rs b/src/func.rs index a7044b6e..14dd5beb 100644 --- a/src/func.rs +++ b/src/func.rs @@ -37,20 +37,20 @@ impl PartialEq for dyn Function { /// A sequence of commands requested for execution by a function. #[derive(Debug)] -pub struct FuncCommands { - pub commands: Vec<Command> +pub struct FuncCommands<'a> { + pub commands: Vec<Command<'a>> } -impl FuncCommands { +impl<'a> FuncCommands<'a> { /// Create an empty command list. - pub fn new() -> FuncCommands { + pub fn new() -> FuncCommands<'a> { FuncCommands { commands: vec![], } } /// Add a command to the sequence. - pub fn add_command(&mut self, command: Command) { + pub fn add(&mut self, command: Command<'a>) { self.commands.push(command); } @@ -60,9 +60,9 @@ impl FuncCommands { } } -impl IntoIterator for FuncCommands { - type Item = Command; - type IntoIter = std::vec::IntoIter<Command>; +impl<'a> IntoIterator for FuncCommands<'a> { + type Item = Command<'a>; + type IntoIter = std::vec::IntoIter<Command<'a>>; fn into_iter(self) -> Self::IntoIter { self.commands.into_iter() @@ -71,8 +71,8 @@ impl IntoIterator for FuncCommands { /// Commands requested for execution by functions. #[derive(Debug)] -pub enum Command { - Layout(SyntaxTree), +pub enum Command<'a> { + Layout(&'a SyntaxTree), Add(Layout), AddMany(MultiLayout), ToggleStyleClass(FontClass), |
