impl Debug for Device (#253)

The internal alsa, null and emscripten Device implementations already
implemented Debug; but the coreaudio and wasapi ones, and therefore
also the wrapper, did not.

I decided to eschew the `Device(…)` wrapping in the outer layer
(hence a custom implementation rather than `#[derive(Debug)]`),
because `Device(Device)`, `Device(Device { … })` and so forth all
look better without the extra `Device(…)` wrapping.

On the wasapi and coreaudio implementations I put both the pointer and
name. Name because it’s useful, pointer because on Windows at least
I believe duplicated names are possible. (e.g. two monitors that include
monitors, of the same type; I haven’t strictly confirmed this, because I
killed those off harshly on my machine and don’t want to reinstate
them.)

I do not have access to a macOS device to confirm that the coreaudio
implementation is sane, but I think it is.
This commit is contained in:
Chris Morgan 2019-03-23 07:27:17 +11:00 • committed by Pierre Krieger
parent c2d606176a
commit 2679ea845f
3 changed files with 26 additions and 0 deletions

View file

@ -395,6 +395,12 @@ impl Device {
}
}
impl fmt::Debug for Device {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(&self.0, f)
}
}
impl EventLoop {
/// Initializes a new events loop.
#[inline]