termimad/inline.rs
1use std::fmt;
2
3use crate::{
4 composite::FmtComposite,
5 skin::MadSkin,
6};
7
8/// A directly printable markdown snippet, complete
9/// with the reference to a skin so that it can
10/// implement the Display trait.
11///
12/// Use this when you don't have a text but just
13/// part of a line
14pub struct FmtInline<'k, 's> {
15 pub skin: &'k MadSkin,
16 pub composite: FmtComposite<'s>,
17}
18
19impl fmt::Display for FmtInline<'_, '_> {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 self.skin
22 .write_fmt_composite(f, &self.composite, None, false, true)
23 }
24}