Skip to main content

use_bond/
bond_polarity.rs

1use std::fmt;
2
3/// A lightweight bond polarity label.
4#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub enum BondPolarity {
6    /// Nonpolar bond.
7    Nonpolar,
8    /// Polar bond.
9    Polar,
10    /// Ionic bond polarity.
11    Ionic,
12    /// Unknown or intentionally unspecified bond polarity.
13    Unknown,
14}
15
16impl fmt::Display for BondPolarity {
17    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
18        let value = match self {
19            Self::Nonpolar => "nonpolar",
20            Self::Polar => "polar",
21            Self::Ionic => "ionic",
22            Self::Unknown => "unknown",
23        };
24
25        formatter.write_str(value)
26    }
27}