Skip to main content

use_bond/
bond_kind.rs

1use std::fmt;
2
3/// A lightweight chemical bond kind label.
4#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub enum BondKind {
6    /// Covalent bond.
7    Covalent,
8    /// Ionic bond.
9    Ionic,
10    /// Metallic bond.
11    Metallic,
12    /// Coordinate bond.
13    Coordinate,
14    /// Hydrogen bond.
15    Hydrogen,
16    /// Aromatic bond.
17    Aromatic,
18    /// Van der Waals interaction.
19    VanDerWaals,
20    /// Dipole-dipole interaction.
21    DipoleDipole,
22    /// London dispersion interaction.
23    LondonDispersion,
24    /// Unknown or intentionally unspecified bond kind.
25    Unknown,
26}
27
28impl fmt::Display for BondKind {
29    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
30        let value = match self {
31            Self::Covalent => "covalent",
32            Self::Ionic => "ionic",
33            Self::Metallic => "metallic",
34            Self::Coordinate => "coordinate",
35            Self::Hydrogen => "hydrogen",
36            Self::Aromatic => "aromatic",
37            Self::VanDerWaals => "van der Waals",
38            Self::DipoleDipole => "dipole-dipole",
39            Self::LondonDispersion => "London dispersion",
40            Self::Unknown => "unknown",
41        };
42
43        formatter.write_str(value)
44    }
45}