1pub trait DiscNum {
9 fn hole() -> Self;
11}
12
13pub trait AsPlotnum {
14 type Target: PlotNum;
15 fn as_plotnum(&self) -> &Self::Target;
16}
17impl<P: PlotNum> AsPlotnum for P {
18 type Target = P;
19 fn as_plotnum(&self) -> &Self::Target {
20 self
21 }
22}
23
24pub trait PlotNum: PartialOrd + Copy + std::fmt::Debug {
29 fn is_hole(&self) -> bool;
31
32 fn scale(&self, range: &[Self; 2], max: f64) -> f64;
33
34 fn unit_range(offset: Option<Self>) -> [Self; 2];
35}
36
37pub trait HasDefaultTicks: Sized {
38 type DefaultTicks: crate::ticks::TickDistGen<Self>;
39 fn default_ticks() -> Self::DefaultTicks;
40}
41
42use std::fmt;
43
44pub trait BaseFmt {
48 fn write_title(&self, writer: &mut dyn fmt::Write) -> fmt::Result;
49 fn write_xname(&self, writer: &mut dyn fmt::Write) -> fmt::Result;
50 fn write_yname(&self, writer: &mut dyn fmt::Write) -> fmt::Result;
51}
52
53pub trait HasZero {
57 fn zero() -> Self;
58}