fn parse_metadata(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("Malformed key/value pair"),
                None,
            ))
        }
    });
    let v = &v[1..];

    match k {
        "Title" => chart.song_name = Some(v.into()),
        "TitleUnicode" => chart.song_name_unicode = Some(v.into()),
        "Artist" => chart.artist = Some(v.into()),
        "ArtistUnicode" => chart.artist_unicode = Some(v.into()),
        "Creator" => chart.creator = Some(v.into()),
        "Version" => chart.difficulty_name = Some(v.into()),
        _ => (),
    }
    Ok(())
}
/// Parse a line from the Metadata section and add the info to the chart passed in
Parse a line from the Metadata section and add the info to the chart passed in
Parse a line from the Metadata section and add the info to the chart passed in
fn parse_metadata(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("Malformed key/value pair"),
                None,
            ))
        }
    });
    let v = &v[1..];
    match k {
        "Title" => chart.song_name = Some(v.into()),
        "TitleUnicode" => chart.song_name_unicode = Some(v.into()),
        "Artist" => chart.artist = Some(v.into()),
        "ArtistUnicode" => chart.artist_unicode = Some(v.into()),
        "Creator" => chart.creator = Some(v.into()),
        "Version" => chart.difficulty_name = Some(v.into()),
        _ => (),
    }
    Ok(())
}
fn parse_metadata ( 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 [ 1 .. ] ; match k { " " => chart . song_name = Some ( v . into ( ) ) , " " => chart . song_name_unicode = Some ( v . into ( ) ) , " " => chart . artist = Some ( v . into ( ) ) , " " => chart . artist_unicode = Some ( v . into ( ) ) , " " => chart . creator = Some ( v . into ( ) ) , " " => chart . difficulty_name = Some ( v . into ( ) ) , _ => ( ) , } Ok ( ( ) ) }
Parse a line from the Metadata section and add the info to the chart passed in
Parse a line from the Metadata section and add the info to the chart passed in
line
&str
chart
&mut IncompleteChart
line
&str
chart
&mut IncompleteChart