Skip to content

Commit de58437

Browse files
committed
OscilloscopeStyle is Display
1 parent 0e1aff6 commit de58437

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

viz-udp-app-lib/src/oscilloscope.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::common::{
33
VizUdpServer, samples_from_ne_bytes, samples_to_ne_bytes,
44
};
55
use std::{
6+
fmt::Display,
67
net::{SocketAddr, ToSocketAddrs},
78
process::{Child, Command},
89
};
@@ -13,13 +14,14 @@ pub enum OscilloscopeStyle {
1314
TimeDomain,
1415
TimeDomainStereo,
1516
}
16-
impl ToString for OscilloscopeStyle {
17-
fn to_string(&self) -> String {
17+
18+
impl Display for OscilloscopeStyle {
19+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1820
match self {
19-
OscilloscopeStyle::Xy => format!("xy"),
20-
OscilloscopeStyle::TimeDomain => format!("time-domain"),
21+
OscilloscopeStyle::Xy => write!(f, "xy"),
22+
OscilloscopeStyle::TimeDomain => write!(f, "time-domain"),
2123
OscilloscopeStyle::TimeDomainStereo => {
22-
format!("time-domain-stereo")
24+
write!(f, "time-domain-stereo")
2325
}
2426
}
2527
}

0 commit comments

Comments
 (0)