Avoid duplication for Series (#1138)

* avoid duplication for series

* revised series
This commit is contained in:
Luca Plian 2024-01-19 17:36:54 +02:00 committed by GitHub
parent 4c6aa8d054
commit e149fda95f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,6 +14,7 @@ pub fn main() {
run(settings);
}
fn run(mut settings: Settings) {
abstutil::logger::setup();
settings = settings.read_svg(Box::new(abstio::slurp_bytes));
@ -55,11 +56,11 @@ impl Demo {
tabs,
}
}
fn create_series<F>(&self, label: &str, color: Color, func: F) -> Series
fn create_series<F>(&self, label: &str, color: Color, func: F) -> Series<Time, usize>
where
F: Fn(usize) -> usize,
{
Series {
Series{
label: label.to_string(),
color,
pts: (0..(self.elapsed.inner_seconds() as usize))