markdown_composer/types/
paragraph.rs1#[cfg(feature = "serde")]
2use serde::{Deserialize, Serialize};
3use std::fmt;
4
5#[derive(Clone, Debug)]
10#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
11pub struct Paragraph {
12 pub text: String,
14}
15
16impl Paragraph {
17 pub fn from(text: impl Into<String>) -> Self {
19 Self { text: text.into() }
20 }
21}
22
23impl fmt::Display for Paragraph {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 writeln!(f, "{}", self.text)
26 }
27}