~ruther/map-led-strip

ref: 300483330bc7a55f293352588c711215854eb48f map-led-strip/src/commands/command_data.rs -rw-r--r-- 586 bytes
30048333 — František Boháček chore: split command_data to separate file 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
    }
}
Do not follow this link