codegen_rs/docs.rs
1use std::fmt::{self, Write};
2
3use crate::formatter::Formatter;
4
5#[derive(Debug, Clone)]
6pub struct Docs {
7 docs: String,
8}
9
10impl Docs {
11 pub fn new(docs: &str) -> Self {
12 Self {
13 docs: docs.to_string(),
14 }
15 }
16
17 pub fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
18 for line in self.docs.lines() {
19 writeln!(fmt, "/// {}", line)?;
20 }
21
22 Ok(())
23 }
24}