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
use crate::Error;
use crate::LayoutCell;
use std::str::FromStr;
#[derive(Default, PartialEq, Clone, Debug)]
pub struct Layout {
pub checksum: usize,
pub cell: LayoutCell,
}
impl FromStr for Layout {
type Err = Error;
fn from_str(s: &str) -> Result<Layout, Error> {
let mut layout = Layout::new();
let ls: Vec<&str> = s.split(',').collect();
layout.checksum = usize::from_str_radix(ls[0], 16)?;
layout.cell = ls[1].parse()?;
Ok(layout)
}
}
impl Layout {
pub fn new() -> Self {
Default::default()
}
}