diff --git a/graphics/src/text/paragraph.rs b/graphics/src/text/paragraph.rs index 8e8907f98a..d99b841201 100644 --- a/graphics/src/text/paragraph.rs +++ b/graphics/src/text/paragraph.rs @@ -7,7 +7,7 @@ use crate::text::{self, FontSystem}; use std::fmt; use std::sync::{self, Arc}; -#[derive(Clone, PartialEq, Default)] +#[derive(Clone, PartialEq)] pub struct Paragraph(Option>); struct Internal { @@ -195,6 +195,28 @@ impl core::text::Paragraph for Paragraph { } } +impl Default for Paragraph { + fn default() -> Self { + Self(Some(Arc::new(Internal::default()))) + } +} + +impl fmt::Debug for Paragraph { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let paragraph = self.internal(); + + f.debug_struct("Paragraph") + .field("content", ¶graph.content) + .field("font", ¶graph.font) + .field("shaping", ¶graph.shaping) + .field("horizontal_alignment", ¶graph.horizontal_alignment) + .field("vertical_alignment", ¶graph.vertical_alignment) + .field("bounds", ¶graph.bounds) + .field("min_bounds", ¶graph.min_bounds) + .finish() + } +} + impl PartialEq for Internal { fn eq(&self, other: &Self) -> bool { self.content == other.content @@ -226,22 +248,6 @@ impl Default for Internal { } } -impl fmt::Debug for Paragraph { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let paragraph = self.internal(); - - f.debug_struct("Paragraph") - .field("content", ¶graph.content) - .field("font", ¶graph.font) - .field("shaping", ¶graph.shaping) - .field("horizontal_alignment", ¶graph.horizontal_alignment) - .field("vertical_alignment", ¶graph.vertical_alignment) - .field("bounds", ¶graph.bounds) - .field("min_bounds", ¶graph.min_bounds) - .finish() - } -} - #[derive(Debug, Clone)] pub struct Weak { raw: sync::Weak,