Skip to content

Commit db3e08e

Browse files
committed
Add all leftover public Debug impl, enforce at crate level
1 parent 62b18f3 commit db3e08e

File tree

11 files changed

+45
-8
lines changed

11 files changed

+45
-8
lines changed

src/capacity.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ use crate::context::{BaseAudioContext, ConcreteBaseAudioContext};
55
use crate::events::{EventDispatch, EventHandler, EventPayload, EventType};
66
use crate::Event;
77

8-
#[derive(Copy, Clone)]
8+
#[derive(Copy, Clone, Debug)]
99
pub(crate) struct AudioRenderCapacityLoad {
1010
pub render_timestamp: f64,
1111
pub load_value: f64,
1212
}
1313

1414
/// Options for constructing an `AudioRenderCapacity`
15+
#[derive(Clone, Debug)]
1516
pub struct AudioRenderCapacityOptions {
1617
/// An update interval (in seconds) for dispatching [`AudioRenderCapacityEvent`]s
1718
pub update_interval: f64,
@@ -70,6 +71,17 @@ pub struct AudioRenderCapacity {
7071
stop_send: Arc<Mutex<Option<Sender<()>>>>,
7172
}
7273

74+
impl std::fmt::Debug for AudioRenderCapacity {
75+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
76+
f.debug_struct("AudioRenderCapacity")
77+
.field(
78+
"context",
79+
&format!("BaseAudioContext@{}", self.context.address()),
80+
)
81+
.finish_non_exhaustive()
82+
}
83+
}
84+
7385
impl AudioRenderCapacity {
7486
pub(crate) fn new(
7587
context: ConcreteBaseAudioContext,

src/context/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! The `BaseAudioContext` interface and the `AudioContext` and `OfflineAudioContext` types
22
3-
#![deny(missing_debug_implementations)]
4-
53
use std::{any::Any, ops::Range};
64

75
mod base;

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![warn(clippy::missing_panics_doc)]
55
#![warn(clippy::clone_on_ref_ptr)]
66
#![deny(trivial_numeric_casts)]
7+
#![deny(missing_debug_implementations)]
78

89
use std::error::Error;
910
use std::sync::atomic::{AtomicU32, AtomicU64, Ordering};

src/media_devices/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,14 @@ impl MediaDeviceInfo {
127127

128128
/// Dictionary used to instruct what sort of tracks to include in the [`MediaStream`] returned by
129129
/// [`get_user_media_sync`]
130+
#[derive(Clone, Debug)]
130131
pub enum MediaStreamConstraints {
131132
Audio,
132133
AudioWithConstraints(MediaTrackConstraints),
133134
}
134135

135136
/// Desired media stream track settings for [`MediaTrackConstraints`]
136-
#[derive(Default)]
137+
#[derive(Default, Debug, Clone)]
137138
#[non_exhaustive]
138139
pub struct MediaTrackConstraints {
139140
// ConstrainULong width;

src/media_recorder/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ pub struct MediaRecorder {
149149
inner: Arc<MediaRecorderInner>,
150150
}
151151

152+
impl std::fmt::Debug for MediaRecorder {
153+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
154+
f.debug_struct("MediaRecorder")
155+
.field("stream", &self.inner.stream)
156+
.field("active", &self.inner.active)
157+
.finish_non_exhaustive()
158+
}
159+
}
160+
152161
impl MediaRecorder {
153162
/// Creates a new `MediaRecorder` object, given a [`MediaStream`] to record.
154163
///

src/node/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! The AudioNode interface and concrete types
22
3-
#![deny(missing_debug_implementations)]
4-
53
use std::f32::consts::PI;
64
use std::sync::{Arc, Mutex, OnceLock};
75

src/param.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! AudioParam interface
2+
23
use std::any::Any;
34
use std::slice::{Iter, IterMut};
45
use std::sync::atomic::Ordering;

src/periodic_wave.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! PeriodicWave interface
2+
23
use std::f32::consts::PI;
34
use std::sync::Arc;
45

src/render/processor.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ pub struct RenderScope {
2626
pub(crate) event_sender: Option<Sender<EventDispatch>>,
2727
}
2828

29+
impl std::fmt::Debug for RenderScope {
30+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31+
let mut format = f.debug_struct("RenderScope");
32+
format
33+
.field("current_frame", &self.current_frame)
34+
.field("current_time", &self.current_time)
35+
.field("sample_rate", &self.sample_rate)
36+
.finish_non_exhaustive()
37+
}
38+
}
39+
2940
impl RenderScope {
3041
pub(crate) fn send_ended_event(&self) {
3142
if let Some(sender) = self.event_sender.as_ref() {
@@ -154,6 +165,12 @@ pub struct AudioParamValues<'a> {
154165
nodes: &'a NodeCollection,
155166
}
156167

168+
impl<'a> std::fmt::Debug for AudioParamValues<'a> {
169+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
170+
f.debug_struct("AudioParamValues").finish_non_exhaustive()
171+
}
172+
}
173+
157174
impl<'a> AudioParamValues<'a> {
158175
pub(crate) fn from(nodes: &'a NodeCollection) -> Self {
159176
Self { nodes }

src/spatial.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub(crate) const PARAM_OPTS: AudioParamDescriptor = AudioParamDescriptor {
2828
/// # Usage
2929
///
3030
/// For example usage, check the [`PannerNode`](crate::node::PannerNode) docs.
31+
#[derive(Debug)]
3132
pub struct AudioListener {
3233
pub(crate) position_x: AudioParam,
3334
pub(crate) position_y: AudioParam,

0 commit comments

Comments
 (0)