Implement Display and Error for DefaultFormatError (#230)
This commit is contained in:
parent
20fffb26fb
commit
77ce5eba06
22
src/lib.rs
22
src/lib.rs
|
@ -740,6 +740,28 @@ impl Error for CreationError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for DefaultFormatError {
|
||||||
|
#[inline]
|
||||||
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
|
write!(fmt, "{}", self.description())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Error for DefaultFormatError {
|
||||||
|
#[inline]
|
||||||
|
fn description(&self) -> &str {
|
||||||
|
match self {
|
||||||
|
&DefaultFormatError::DeviceNotAvailable => {
|
||||||
|
CreationError::DeviceNotAvailable.description()
|
||||||
|
},
|
||||||
|
|
||||||
|
&DefaultFormatError::StreamTypeNotSupported => {
|
||||||
|
"The requested stream type is not supported by the device."
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If a backend does not provide an API for retrieving supported formats, we query it with a bunch
|
// If a backend does not provide an API for retrieving supported formats, we query it with a bunch
|
||||||
// of commonly used rates. This is always the case for wasapi and is sometimes the case for alsa.
|
// of commonly used rates. This is always the case for wasapi and is sometimes the case for alsa.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue