use std::string::*;
use std::fmt;
+/// Generic format parsing error.
+#[derive(Clone,Copy,Debug,PartialEq)]
+pub struct FormatParseError {}
+
/// Audio format definition.
///
/// The structure describes how audio samples are stored and what characteristics they have.
}
}
-/// Generic soniton parsing error.
-#[derive(Clone,Copy,Debug,PartialEq)]
-pub struct SonitonParseError {}
-
impl FromStr for NASoniton {
- type Err = SonitonParseError;
+ type Err = FormatParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"s32le" => Ok(NASoniton { bits: 32, be: false, packed: false, planar: false, float: false, signed: true }),
"f32be" => Ok(NASoniton { bits: 32, be: true, packed: false, planar: false, float: true, signed: true }),
"f32le" => Ok(NASoniton { bits: 32, be: false, packed: false, planar: false, float: true, signed: true }),
- _ => Err(SonitonParseError{}),
+ _ => Err(FormatParseError{}),
}
}
}
}
}
-/// Generic channel configuration parsing error.
-#[derive(Clone,Copy,Debug,PartialEq)]
-pub struct ChannelParseError {}
-
impl FromStr for NAChannelType {
- type Err = ChannelParseError;
+ type Err = FormatParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"Rt" => Ok(NAChannelType::Rt),
"Lo" => Ok(NAChannelType::Lo),
"Ro" => Ok(NAChannelType::Ro),
- _ => Err(ChannelParseError{}),
+ _ => Err(FormatParseError{}),
}
}
}
}
impl FromStr for NAChannelMap {
- type Err = ChannelParseError;
+ type Err = FormatParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut chm = NAChannelMap::new();