1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::io::Write;
use super::Context;
use super::Renderable;
use error::{Result, ResultLiquidChainExt};
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Text {
text: String,
}
impl Text {
pub fn new<S: Into<String>>(text: S) -> Text {
Text { text: text.into() }
}
}
impl Renderable for Text {
fn render_to(&self, writer: &mut Write, _context: &mut Context) -> Result<()> {
write!(writer, "{}", &self.text).chain("Failed to render")?;
Ok(())
}
}