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
// (c) 2016 Productize SPRL <joost@productize.be>

// extension: .pro
// format: special project format

// first line starts with:
// update=

// get from parent
use Result;
use str_error;

/// a Kicad project
#[derive(Debug)]
pub struct Project {
    /// project file content as an unparsed String
    pub data: String,
}

/// parse a &str to a project
pub fn parse_str(s: &str) -> Result<Project> {
    if !s.starts_with("update=") {
        str_error("not a kicad project file!".to_string())
    } else {
        Ok(Project {
            data: String::from(s),
        })
    }

}