gnuplot_wrapper/commands/
set.rs

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
29
30
use crate::{command::Command, script::Script};

/// http://gnuplot.info/docs_5.5/loc10058.html
pub struct Set {
    value: String,
}

impl Set {
    pub fn new(str: &str) -> Self {
        return Set {
            value: str.to_string(),
        };
    }
}

impl Command for Set {
    fn to_raw(&self) -> String {
        return format!("set {}", self.value);
    }
}

impl Script {
    pub fn set(&mut self, str: &str) {
        self.add_command(Set::new(str));
    }

    pub fn set_grid(&mut self) {
        self.add_command(Set::new("grid"));
    }
}