Function pls::write [] [src]

pub fn write<'i, I: IntoIterator<Item=&'i PlaylistElement>, W: Write>(what: I,
                                                                      to: &mut W)
                                                                      -> Result<()>

Write a playlist to the specified output stream

Examples

let mut buf = Vec::new();
pls::write(&[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,
           }],
           &mut buf).unwrap();
assert_eq!(String::from_utf8(buf).unwrap(),
           "[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\
            \n\
            NumberOfEntries=3\n\
            Version=2\n")