use std::io::{Read, Write};
use crate::{Lyrics, LyricsError};
impl Lyrics {
pub fn from_reader<R: Read>(mut reader: R) -> Result<Lyrics, LyricsError> {
let mut s = String::new();
reader.read_to_string(&mut s)?;
Lyrics::from_str(s)
}
pub fn to_writer<W: Write>(&self, mut writer: W) -> Result<(), LyricsError> {
writer.write_all(self.to_string().as_bytes())?;
Ok(())
}
}