liquid_core/parser/
text.rs1use std::io::Write;
2
3use crate::error::{Result, ResultLiquidReplaceExt};
4use crate::runtime::Renderable;
5use crate::runtime::Runtime;
6
7#[derive(Clone, Debug, Eq, PartialEq)]
9pub(crate) struct Text {
10 text: String,
11}
12
13impl Text {
14 pub(crate) fn new<S: Into<String>>(text: S) -> Text {
16 Text { text: text.into() }
17 }
18}
19
20impl Renderable for Text {
21 fn render_to(&self, writer: &mut dyn Write, _runtime: &dyn Runtime) -> Result<()> {
22 write!(writer, "{}", &self.text).replace("Failed to render")?;
23 Ok(())
24 }
25}