use crate::{
parsers::{FileParserBuilder, Load},
AnyResult, Case, Value,
};
use std::io::Read;
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Failed parse YAML")]
ParseYaml(#[source] serde_yaml::Error),
}
pub type ParserBuilder = FileParserBuilder<LoadYaml>;
#[derive(Clone, Default)]
pub struct LoadYaml;
impl Case for LoadYaml {}
impl Load for LoadYaml {
#[inline]
fn load(&mut self, reader: impl Read) -> AnyResult<Value> {
Ok(serde_yaml::from_reader(reader).map_err(Error::ParseYaml)?)
}
}