summaryrefslogtreecommitdiffstats
path: root/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 2e585b0..4596b3f 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -67,34 +67,3 @@ where
67 message: format!("{}", error), 67 message: format!("{}", error),
68 } 68 }
69} 69}
70
71pub fn decibel_to_ratio(decibel: f64) -> f64 {
72 10f64.powf(decibel / 10f64).sqrt()
73}
74
75/*
76fn introspect(conn: &dbus::ConnPath<&Connection>) {
77 let mut thing = conn
78 .method_call_with_args(
79 &"org.freedesktop.DBus.Introspectable".into(),
80 &"Introspect".into(),
81 |_| {},
82 ).unwrap();
83 thing.as_result().unwrap();
84
85 println!("{}", thing.iter_init().read::<String>().unwrap());
86}
87*/
88
89#[cfg(test)]
90mod tests {
91
92 #[test]
93 fn decibel_to_ratio() {
94 assert_eq!(super::decibel_to_ratio(0f64), 1f64);
95 assert_eq!(super::decibel_to_ratio(20f64), 10f64);
96 assert_eq!(super::decibel_to_ratio(40f64), 100f64);
97 assert_eq!(super::decibel_to_ratio(60f64), 1000f64);
98 }
99
100}