alpha
Login
or
Join now
gwen.works
/
shapemaker
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
🔥 Remove useless crate num-traits
author
Gwenn Le Bihan
date
8 months ago
(Oct 27, 2025, 10:50 PM +0100)
commit
cc8fef9f
cc8fef9fa77e724655bb48b3db16f3d27c88346e
parent
ec4c3728
ec4c3728953280475a20b79308c42dbd4e2e1fc1
+22
-31
3 changed files
Expand all
Collapse all
Unified
Split
Cargo.lock
Cargo.toml
src
ui.rs
-1
Cargo.lock
Reviewed
···
4595
4595
"nanoid",
4596
4596
"ndarray",
4597
4597
"nih_plug",
4598
4598
-
"num-traits",
4599
4598
"once_cell",
4600
4599
"quick-xml",
4601
4600
"rand 0.9.2",
-1
Cargo.toml
Reviewed
···
109
109
quick-xml = "0.38.3"
110
110
vgv = { git = "https://github.com/gwennlbh/vgvf", version = "0.1.0", optional = true}
111
111
serde-aux = "4.7.0"
112
112
-
num-traits = "0.2.19"
113
112
114
113
115
114
[dev-dependencies]
+22
-29
src/ui.rs
Reviewed
···
2
2
use console::Style;
3
3
use indicatif::{ProgressBar, ProgressStyle};
4
4
use itertools::Itertools;
5
5
-
use num_traits::ops::euclid::Euclid;
6
5
use std::borrow::Cow;
7
6
use std::collections::HashMap;
8
7
use std::ops::Range;
···
136
135
.join(", ")
137
136
}
138
137
139
139
-
pub(crate) fn format_timestamp(duration: impl IntoTimestamp) -> String {
140
140
-
format!(
141
141
-
"{}",
142
142
-
DateTime::from_timestamp_millis(duration.as_millis() as i64)
143
143
-
.unwrap()
144
144
-
.format("%H:%M:%S%.3f")
145
145
-
)
146
146
-
}
147
147
-
148
138
pub(crate) fn format_duration(duration: Duration) -> String {
149
149
-
let (hours, rest) = duration.as_millis().div_rem_euclid(&3_600_000);
150
150
-
let (minutes, rest) = rest.div_rem_euclid(&60_000);
151
151
-
let (seconds, milliseconds) = rest.div_rem_euclid(&1_000);
139
139
+
let (hours, rest) = duration.as_millis().div_rem(&3_600_000);
140
140
+
let (minutes, rest) = rest.div_rem(&60_000);
141
141
+
let (seconds, milliseconds) = rest.div_rem(&1_000);
152
142
153
143
if hours > 0 {
154
144
format!("{} h {:02} m {:02} s", hours, minutes, seconds)
···
161
151
}
162
152
}
163
153
154
154
+
trait DivRem<T> {
155
155
+
fn div_rem(&self, rhs: &T) -> (T, T);
156
156
+
}
157
157
+
158
158
+
impl DivRem<u128> for u128 {
159
159
+
fn div_rem(&self, rhs: &u128) -> (u128, u128) {
160
160
+
(self / rhs, self % rhs)
161
161
+
}
162
162
+
}
163
163
+
164
164
+
pub(crate) fn format_timestamp(ms: usize) -> String {
165
165
+
format!(
166
166
+
"{}",
167
167
+
DateTime::from_timestamp_millis(ms as i64)
168
168
+
.unwrap()
169
169
+
.format("%H:%M:%S%.3f")
170
170
+
)
171
171
+
}
172
172
+
164
173
pub(crate) fn format_timestamp_range(ms_range: &Range<usize>) -> String {
165
174
format!(
166
175
"from {} to {}",
···
176
185
path.to_string_lossy()
177
186
)
178
187
}
179
179
-
180
180
-
pub(crate) trait IntoTimestamp {
181
181
-
fn as_millis(&self) -> usize;
182
182
-
}
183
183
-
184
184
-
impl IntoTimestamp for usize {
185
185
-
fn as_millis(&self) -> usize {
186
186
-
*self
187
187
-
}
188
188
-
}
189
189
-
190
190
-
// impl IntoTimestamp for std::time::Duration {
191
191
-
// fn as_millis(&self) -> usize {
192
192
-
// self.as_millis() as usize
193
193
-
// }
194
194
-
// }