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
26
27
28
29
30
31
32
33
use std::fmt;

use node::{Node, Value};

/// A text node.
pub struct Text {
    content: String,
}

impl Text {
    /// Create a node.
    #[inline]
    pub fn new<T>(content: T) -> Self where T: Into<String> {
        Text { content: content.into() }
    }
}

impl fmt::Display for Text {
    #[inline]
    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
        self.content.fmt(formatter)
    }
}

impl Node for Text {
    #[inline]
    fn append<T>(&mut self, _: T) where T: Node {
    }

    #[inline]
    fn assign<T, U>(&mut self, _: T, _: U) where T: Into<String>, U: Into<Value> {
    }
}