use std::error::Error;
use serde::Deserialize;
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "api_debug", serde(deny_unknown_fields))]
pub enum AltStreamResult<T> {
Data(T),
Error(String),
}
impl<T> AltStreamResult<T> {
pub fn data(self) -> Result<T, Box<dyn Error>> {
match self {
AltStreamResult::Data(data) => Ok(data),
AltStreamResult::Error(err) => Err(Box::new(std::io::Error::other(err))),
}
}
}