pub trait BondsNumber {
// Required method
fn number_of_bonds(&self) -> (u8, u8);
// Provided method
fn is_noble_gas(&self) -> bool { ... }
}Expand description
Minimum and maximum number of bonds an element can form.
Required Methods§
Sourcefn number_of_bonds(&self) -> (u8, u8)
fn number_of_bonds(&self) -> (u8, u8)
Returns (min_bonds, max_bonds) for the element.
§Examples
use elements_rs::{BondsNumber, Element};
let (min, max) = Element::H.number_of_bonds();
assert_eq!((min, max), (1, 1));
let (min, max) = Element::C.number_of_bonds();
assert_eq!((min, max), (4, 4));Provided Methods§
Sourcefn is_noble_gas(&self) -> bool
fn is_noble_gas(&self) -> bool
Returns true for noble gases (elements with zero bonds).
§Examples
use elements_rs::{BondsNumber, Element};
assert!(Element::He.is_noble_gas());
assert!(!Element::H.is_noble_gas());