And provide for f64
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
//---------- Pos ----------
-impl PosC<Coord> {
- pub fn promote(&self) -> PosC<f64> { self.map(|v| v as f64) }
+pub trait PosPromote {
+ fn promote(&self) -> PosC<f64>;
+}
+impl<T> PosPromote for PosC<T> where T: Into<f64> + Copy + Debug {
+ fn promote(&self) -> PosC<f64> { self.map(|v| v.into()) }
}
#[derive(Error,Debug,Copy,Clone,Serialize,Deserialize)]
pub use crate::html::*;
-pub use crate::geometry::{CoordinateOverflow, PosC};
+pub use crate::geometry::{CoordinateOverflow, PosC, PosPromote};
pub use crate::{hformat, hformat_as_display, hwrite};
pub use crate::misc::default;
pub use crate::misc::display_as_debug;