Function pls::parse [] [src]

pub fn parse<R: Read>(what: &mut R) -> Result<Vec<PlaylistElement>, ParseError>

Parse a playlist

The parser is very lenient and allows pretty much everything as long as the required stuff's in.

Examples

assert_eq!(pls::parse(&mut &b"[playlist]\n\
                              File1=Track 1.mp3\n\
                              Title1=Unknown Artist - Track 1\n\
                              \n\
                              File2=Track 2.mp3\n\
                              Length2=420\n\
                              \n\
                              File3=Track 3.mp3\n\
                              Length3=-1\n\
                              \n\
                              NumberOfEntries=3\n"[..]).unwrap(),
           vec![PlaylistElement {
               path: "Track 1.mp3".to_string(),
               title: Some("Unknown Artist - Track 1".to_string()),
               len: ElementLength::Unknown,
           },
           PlaylistElement {
               path: "Track 2.mp3".to_string(),
               title: None,
               len: ElementLength::Seconds(420),
           },
           PlaylistElement {
               path: "Track 3.mp3".to_string(),
               title: None,
               len: ElementLength::Unknown,
           }]);