cursive-tree 0.0.9

Tree view for the Cursive TUI library
Documentation
use cursive::{style::*, utils::span::*};

//
// Symbol
//

/// Tree node symbol.
///
/// Note that its char count *must be 1*.
pub enum Symbol<'string> {
    /// Spanned string (potentially styled).
    SpannedString(SpannedString<Style>),

    /// String (plain).
    String(&'string str),
}

impl<'string> From<SpannedString<Style>> for Symbol<'string> {
    fn from(string: SpannedString<Style>) -> Self {
        Self::SpannedString(string)
    }
}

impl<'string> From<&'string str> for Symbol<'string> {
    fn from(string: &'string str) -> Self {
        Self::String(string)
    }
}