/// Parse a line from the General section and add the info to the chart passed in
Parse a line from the General section and add the info to the chart passed in
Parse a line from the General section and add the info to the chart passed in
fn parse_general(line: &str, chart: &mut IncompleteChart) -> Result<(), ParseError> {
    let (k, v) = line.split_at(match line.find(':') {
        Some(n) => n,
        None => {
            return Err(ParseError::Parse(
                String::from("Error parsing General section: Malformed key/value pair"),
                None,
            ))
        }
    });
    let v = &v[2..];
    match k {
        "AudioFilename" => chart.music_path = Some(v.into()),
        "Mode" => if v != "3" {
            return Err(ParseError::Parse(
                String::from("Osu chart is wrong gamemode"),
                None,
            ));
        },
        _ => (),
    }
    Ok(())
}
fn parse_general ( line : & str , chart : & mut IncompleteChart ) -> Result < ( ) , ParseError > { let ( k , v ) = line . split_at ( match line . find ( ':' ) { Some ( n ) => n , None => { return Err ( ParseError :: Parse ( String :: from ( " " ) , None , ) ) } } ) ; let v = & v [ 2 .. ] ; match k { " " => chart . music_path = Some ( v . into ( ) ) , " " => if v != " " { return Err ( ParseError :: Parse ( String :: from ( " " ) , None , ) ) ; } , _ => ( ) , } Ok ( ( ) ) }
Parse a line from the General section and add the info to the chart passed in
Parse a line from the General section and add the info to the chart passed in
line
&str
chart
&mut IncompleteChart