~ruther/map-led-strip

300483330bc7a55f293352588c711215854eb48f — František Boháček 1 year, 9 months ago b96d6d8
chore: split command_data to separate file
1 files changed, 28 insertions(+), 0 deletions(-)

A src/commands/command_data.rs
A src/commands/command_data.rs => src/commands/command_data.rs +28 -0
@@ 0,0 1,28 @@
use crate::commands::command::Command;
use crate::map::Map;

pub struct CommandData<'d, 'a> {
    command: &'d Command<'d>,
    map: &'d mut Map<'a>,
}

impl<'d, 'a> CommandData<'d, 'a> {
    pub fn new(command: &'d Command<'d>, map: &'d mut Map<'a>) -> Self {
        CommandData {
            command,
            map
        }
    }

    pub fn command(self) -> &'d Command<'d> {
        self.command
    }

    pub fn map(self) -> &'d mut Map<'a> {
        self.map
    }

    pub fn deconstruct(self) -> (&'d Command<'d>, &'d mut Map<'a>) {
        (self.command, self.map)
    }
}
\ No newline at end of file

Do not follow this link