Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions plotters/src/coord/ranged1d/types/numeric.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::convert::TryFrom;
use std::ops::Range;

use crate::coord::ranged1d::{
use crate::coord::{combinators::WithKeyPoints, ranged1d::{
AsRangedCoord, DefaultFormatting, DiscreteRanged, KeyPointHint, NoDefaultFormatting, Ranged,
ReversibleRanged, ValueFormatter,
};
}};

macro_rules! impl_discrete_trait {
($name:ident) => {
Expand All @@ -26,7 +26,7 @@
}

fn from_index(&self, index: usize) -> Option<Self::ValueType> {
if let Ok(index) = Self::ValueType::try_from(index) {

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (macos-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (macos-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (macos-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (windows-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (macos-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (macos-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (ubuntu-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / test_all_features

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / run_all_examples

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (windows-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (windows-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (windows-latest)

irrefutable `if let` pattern

Check warning on line 29 in plotters/src/coord/ranged1d/types/numeric.rs

View workflow job for this annotation

GitHub Actions / build_and_test (windows-latest)

irrefutable `if let` pattern
return Some(self.0 + index);
}
None
Expand Down Expand Up @@ -268,6 +268,17 @@
.print(*value as f64)
}
}
impl ValueFormatter<f32> for WithKeyPoints<RangedCoordf32> {
fn format(value: &f32) -> String {
crate::data::float::FloatPrettyPrinter {
allow_scientific: false,
min_decimal: 1,
max_decimal: 5,
}
.print(*value as f64)
}
}

make_numeric_coord!(
f64,
RangedCoordf64,
Expand All @@ -286,6 +297,16 @@
.print(*value)
}
}
impl ValueFormatter<f64> for WithKeyPoints<RangedCoordf64> {
fn format(value: &f64) -> String {
crate::data::float::FloatPrettyPrinter {
allow_scientific: false,
min_decimal: 1,
max_decimal: 5,
}
.print(*value)
}
}
make_numeric_coord!(
u32,
RangedCoordu32,
Expand Down
Loading