R2OU7BE4I4QC5IRZU7BJGHJQNTBNF3265LOHZB3QQDQD7OL46G5AC
impl GraphicBuilder {
// Update if required
fn x_min(&mut self, x: f32) {
match self.x_min {
None => self.x_min = Some(x),
Some(old) => if x < old { self.x_min = Some(x) },
}
}
// Update if required
fn x_max(&mut self, x: f32) {
match self.x_max {
None => self.x_min = Some(x),
Some(old) => if x > old { self.x_max = Some(x) },
}
}
// Update if required
fn y_min(&mut self, y: f32) {
match self.y_min {
None => self.y_min = Some(y),
Some(old) => if y < old { self.y_min = Some(y) },
}
}
// Update if required
fn y_max(&mut self, y: f32) {
match self.y_max {
None => self.y_min = Some(y),
Some(old) => if y > old { self.y_max = Some(y) },
}
}
fn scale(&self) -> Scale {
Scale::Single {
x_min: self.x_min.unwrap(),
x_max: self.x_max.unwrap(),
y_min: self.y_min.unwrap(),
y_max: self.y_max.unwrap(),
}
}
}
#[derive(Debug)]
// GraphicJson builder
let mut graphic_json = GraphicJson {
country: *country,
index: *index,
lines: Vec::new(),
sized: None,
dbg!((country, index));
let mut graphic_json_builder = GraphicBuilder {
lines: Vec::new(),
x_min: None,
x_max: None,
y_min: None,
y_max: None,