From e2d17aa9d9491b339e6200c97b52f7ade51fa1d8 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 13 Oct 2019 12:36:45 +0200 Subject: =?UTF-8?q?Move=20functions=20to=20command-based=20architecture=20?= =?UTF-8?q?=E2=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/func.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/func.rs') 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 +pub struct FuncCommands<'a> { + pub commands: Vec> } -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; +impl<'a> IntoIterator for FuncCommands<'a> { + type Item = Command<'a>; + type IntoIter = std::vec::IntoIter>; 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), -- cgit v1.2.3