use_stoichiometry/
reaction_side.rs1use std::fmt;
2
3#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub enum ReactionSide {
6 Reactant,
8 Product,
10}
11
12impl ReactionSide {
13 #[must_use]
15 pub const fn is_reactant(self) -> bool {
16 matches!(self, Self::Reactant)
17 }
18
19 #[must_use]
21 pub const fn is_product(self) -> bool {
22 matches!(self, Self::Product)
23 }
24}
25
26impl fmt::Display for ReactionSide {
27 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
28 match self {
29 Self::Reactant => formatter.write_str("reactant"),
30 Self::Product => formatter.write_str("product"),
31 }
32 }
33}