Skip to main content

cursive_tree/model/
symbol.rs

1use super::representation::*;
2
3//
4// Symbol
5//
6
7/// Tree node symbol.
8///
9/// Note that its char count *must be 1*.
10pub enum Symbol<'string> {
11    /// Representation (potentially styled).
12    Representation(Representation),
13
14    /// String (plain).
15    String(&'string str),
16}
17
18impl<'string> From<Representation> for Symbol<'string> {
19    fn from(represention: Representation) -> Self {
20        Self::Representation(represention)
21    }
22}
23
24impl<'string> From<&'string str> for Symbol<'string> {
25    fn from(string: &'string str) -> Self {
26        Self::String(string)
27    }
28}