balsa 0.3.2

Reference implementation for the Balsa molecular line notation.
Documentation
use std::{fmt, fmt::Write};

use super::{Element, Selection};

#[derive(Debug, PartialEq, Clone)]
pub enum Symbol {
    Star,
    Element(Element),
    Selection(Selection),
}

impl fmt::Display for Symbol {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::Star => f.write_char('*'),
            Self::Element(element) => element.fmt(f),
            Self::Selection(selection) => selection.fmt(f),
        }
    }
}

impl std::default::Default for Symbol {
    fn default() -> Self {
        Symbol::Star
    }
}