|
@@ -27,6 +27,38 @@ pub enum LineType {
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+impl Display for LineType {
|
|
|
|
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
+ match self {
|
|
|
|
+ LineType::Point { _zero, point } => {
|
|
|
|
+ write!(f, "Point: {}", point)
|
|
|
|
+ }
|
|
|
|
+ LineType::Line { _zero, points } => {
|
|
|
|
+ write!(
|
|
|
|
+ f,
|
|
|
|
+ "Line: {}",
|
|
|
|
+ points
|
|
|
|
+ .iter()
|
|
|
|
+ .map(|x| format!("{x}"))
|
|
|
|
+ .collect::<Vec<String>>()
|
|
|
|
+ .join(", ")
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ LineType::Bezier { _zero, points } => {
|
|
|
|
+ write!(
|
|
|
|
+ f,
|
|
|
|
+ "Bezier: {}",
|
|
|
|
+ points
|
|
|
|
+ .iter()
|
|
|
|
+ .map(|x| format!("{x}"))
|
|
|
|
+ .collect::<Vec<String>>()
|
|
|
|
+ .join(", ")
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
// Custom Debug implementation to only print known fields
|
|
// Custom Debug implementation to only print known fields
|
|
#[cfg(not(feature = "default-debug"))]
|
|
#[cfg(not(feature = "default-debug"))]
|
|
impl Debug for LineType {
|
|
impl Debug for LineType {
|
|
@@ -77,7 +109,11 @@ pub struct Lines {
|
|
|
|
|
|
impl Display for Lines {
|
|
impl Display for Lines {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
- write!(f, "{}", self.core)
|
|
|
|
|
|
+ write!(f, "{}", self.core)?;
|
|
|
|
+ for line in &self.lines {
|
|
|
|
+ write!(f, "\n{}", line)?;
|
|
|
|
+ }
|
|
|
|
+ Ok(())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|