Element

Enum Element 

Source
pub enum Element {
Show 118 variants H, He, Li, Be, B, C, N, O, F, Ne, Na, Mg, Al, Si, P, S, Cl, Ar, K, Ca, Sc, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, Zn, Ga, Ge, As, Se, Br, Kr, Rb, Sr, Y, Zr, Nb, Mo, Tc, Ru, Rh, Pd, Ag, Cd, In, Sn, Sb, Te, I, Xe, Cs, Ba, La, Ce, Pr, Nd, Pm, Sm, Eu, Gd, Tb, Dy, Ho, Er, Tm, Yb, Lu, Hf, Ta, W, Re, Os, Ir, Pt, Au, Hg, Tl, Pb, Bi, Po, At, Rn, Fr, Ra, Ac, Th, Pa, U, Np, Pu, Am, Cm, Bk, Cf, Es, Fm, Md, No, Lr, Rf, Db, Sg, Bh, Hs, Mt, Ds, Rg, Cn, Nh, Fl, Mc, Lv, Ts, Og,
}
Expand description

All 118 elements of the periodic table.

use elements_rs::Element;

let oxygen = Element::O;
assert_eq!(oxygen.name(), "Oxygen");
assert_eq!(oxygen.standard_atomic_weight(), 15.999);

Variants§

§

H

Hydrogen

§

He

Helium

§

Li

Lithium

§

Be

Beryllium

§

B

Boron

§

C

Carbon

§

N

Nitrogen

§

O

Oxygen

§

F

Fluorine

§

Ne

Neon

§

Na

Sodium

§

Mg

Magnesium

§

Al

Aluminium

§

Si

Silicon

§

P

Phosphorus

§

S

Sulfur

§

Cl

Chlorine

§

Ar

Argon

§

K

Potassium

§

Ca

Calcium

§

Sc

Scandium

§

Ti

Titanium

§

V

Vanadium

§

Cr

Chromium

§

Mn

Manganese

§

Fe

Iron

§

Co

Cobalt

§

Ni

Nickel

§

Cu

Copper

§

Zn

Zinc

§

Ga

Gallium

§

Ge

Germanium

§

As

Arsenic

§

Se

Selenium

§

Br

Bromine

§

Kr

Krypton

§

Rb

Rubidium

§

Sr

Strontium

§

Y

Yttrium

§

Zr

Zirconium

§

Nb

Niobium

§

Mo

Molybdenum

§

Tc

Technetium

§

Ru

Ruthenium

§

Rh

Rhodium

§

Pd

Palladium

§

Ag

Silver

§

Cd

Cadmium

§

In

Indium

§

Sn

Tin

§

Sb

Antimony

§

Te

Tellurium

§

I

Iodine

§

Xe

Xenon

§

Cs

Caesium

§

Ba

Barium

§

La

Lanthanum

§

Ce

Cerium

§

Pr

Praseodymium

§

Nd

Neodymium

§

Pm

Promethium

§

Sm

Samarium

§

Eu

Europium

§

Gd

Gadolinium

§

Tb

Terbium

§

Dy

Dysprosium

§

Ho

Holmium

§

Er

Erbium

§

Tm

Thulium

§

Yb

Ytterbium

§

Lu

Lutetium

§

Hf

Hafnium

§

Ta

Tantalum

§

W

Tungsten

§

Re

Rhenium

§

Os

Osmium

§

Ir

Iridium

§

Pt

Platinum

§

Au

Gold

§

Hg

Mercury

§

Tl

Thallium

§

Pb

Lead

§

Bi

Bismuth

§

Po

Polonium

§

At

Astatine

§

Rn

Radon

§

Fr

Francium

§

Ra

Radium

§

Ac

Actinium

§

Th

Thorium

§

Pa

Protactinium

§

U

Uranium

§

Np

Neptunium

§

Pu

Plutonium

§

Am

Americium

§

Cm

Curium

§

Bk

Berkelium

§

Cf

Californium

§

Es

Einsteinium

§

Fm

Fermium

§

Md

Mendelevium

§

No

Nobelium

§

Lr

Lawrencium

§

Rf

Rutherfordium

§

Db

Dubnium

§

Sg

Seaborgium

§

Bh

Bohrium

§

Hs

Hassium

§

Mt

Meitnerium

§

Ds

Darmstadtium

§

Rg

Roentgenium

§

Cn

Copernicium

§

Nh

Nihonium

§

Fl

Flerovium

§

Mc

Moscovium

§

Lv

Livermorium

§

Ts

Tennessine

§

Og

Oganesson

Implementations§

Source§

impl Element

Source

pub fn isotopes(&self) -> &'static [Isotope]

Returns the isotopes of the element.

Source§

impl Element

Source

pub fn most_abundant_isotope(&self) -> Isotope

Returns the most common isotope of the element.

Source§

impl Element

Source

pub fn name(&self) -> &str

Returns the full element name (e.g., “Carbon”).

§Examples
use elements_rs::Element;

assert_eq!(Element::H.name(), "Hydrogen");
assert_eq!(Element::O.name(), "Oxygen");
Source§

impl Element

Source

pub fn orbitals(&self) -> &'static [AtomicOrbital]

Returns the orbitals associated to the element.

§Examples
use elements_rs::{AtomicOrbitalType, Element};

let orbitals = Element::H.orbitals();
assert_eq!(orbitals.len(), 1);
assert_eq!(orbitals[0].orbital_type(), AtomicOrbitalType::S);
assert_eq!(orbitals[0].number_of_electrons(), 1);
Source§

impl Element

Source

pub fn is_valid_oxidation_state(&self, state: i16) -> bool

Returns whether the oxidation state is valid for this element.

§Examples
use elements_rs::Element;

assert!(Element::O.is_valid_oxidation_state(-2));
assert!(!Element::O.is_valid_oxidation_state(3));
Source

pub fn oxidation_states(&self) -> &[i16]

Returns all valid oxidation states.

§Examples
use elements_rs::Element;

let states = Element::H.oxidation_states();
assert!(states.contains(&1));
assert!(states.contains(&-1));
Source§

impl Element

Source

pub fn standard_atomic_weight(&self) -> f64

Returns the standard atomic weight.

§Examples
use elements_rs::Element;

assert_eq!(Element::H.standard_atomic_weight(), 1.008);
assert_eq!(Element::O.standard_atomic_weight(), 15.999);

Trait Implementations§

Source§

impl AsRef<Element> for Element

Source§

fn as_ref(&self) -> &Element

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<str> for Element

Source§

fn as_ref(&self) -> &str

Returns the element symbol as a string slice.

§Examples
use elements_rs::Element;

let symbol: &str = Element::H.as_ref();
assert_eq!(symbol, "H");

let oxygen_symbol: &str = Element::O.as_ref();
assert_eq!(oxygen_symbol, "O");
Source§

impl BondsNumber for Element

Source§

fn number_of_bonds(&self) -> (u8, u8)

Returns (min_bonds, max_bonds) for the element. Read more
Source§

fn is_noble_gas(&self) -> bool

Returns true for noble gases (elements with zero bonds). Read more
Source§

impl Clone for Element

Source§

fn clone(&self) -> Element

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Element

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Element

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Element

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the element as its symbol.

§Examples
use elements_rs::Element;

let hydrogen = alloc::format!("{}", Element::H);
assert_eq!(hydrogen, "H");

let magnesium = alloc::format!("{}", Element::Mg);
assert_eq!(magnesium, "Mg");
Source§

impl From<ActiniumIsotope> for Element

Source§

fn from(_isotope: ActiniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<AluminiumIsotope> for Element

Source§

fn from(_isotope: AluminiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<AmericiumIsotope> for Element

Source§

fn from(_isotope: AmericiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<AntimonyIsotope> for Element

Source§

fn from(_isotope: AntimonyIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ArgonIsotope> for Element

Source§

fn from(_isotope: ArgonIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ArsenicIsotope> for Element

Source§

fn from(_isotope: ArsenicIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<AstatineIsotope> for Element

Source§

fn from(_isotope: AstatineIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<BariumIsotope> for Element

Source§

fn from(_isotope: BariumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<BerkeliumIsotope> for Element

Source§

fn from(_isotope: BerkeliumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<BerylliumIsotope> for Element

Source§

fn from(_isotope: BerylliumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<BismuthIsotope> for Element

Source§

fn from(_isotope: BismuthIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<BohriumIsotope> for Element

Source§

fn from(_isotope: BohriumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<BoronIsotope> for Element

Source§

fn from(_isotope: BoronIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<BromineIsotope> for Element

Source§

fn from(_isotope: BromineIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CadmiumIsotope> for Element

Source§

fn from(_isotope: CadmiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CaesiumIsotope> for Element

Source§

fn from(_isotope: CaesiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CalciumIsotope> for Element

Source§

fn from(_isotope: CalciumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CaliforniumIsotope> for Element

Source§

fn from(_isotope: CaliforniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CarbonIsotope> for Element

Source§

fn from(_isotope: CarbonIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CeriumIsotope> for Element

Source§

fn from(_isotope: CeriumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ChlorineIsotope> for Element

Source§

fn from(_isotope: ChlorineIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ChromiumIsotope> for Element

Source§

fn from(_isotope: ChromiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CobaltIsotope> for Element

Source§

fn from(_isotope: CobaltIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CoperniciumIsotope> for Element

Source§

fn from(_isotope: CoperniciumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CopperIsotope> for Element

Source§

fn from(_isotope: CopperIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<CuriumIsotope> for Element

Source§

fn from(_isotope: CuriumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<DarmstadtiumIsotope> for Element

Source§

fn from(_isotope: DarmstadtiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<DubniumIsotope> for Element

Source§

fn from(_isotope: DubniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<DysprosiumIsotope> for Element

Source§

fn from(_isotope: DysprosiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<EinsteiniumIsotope> for Element

Source§

fn from(_isotope: EinsteiniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<Element> for ElementMask

Source§

fn from(element: Element) -> Self

§Examples
use elements_rs::{Element, ElementMask};

let mask: ElementMask = Element::H.into();
assert!(mask.contains(Element::H));
Source§

impl From<Element> for u8

Source§

fn from(element: Element) -> Self

Converts an element to its atomic number.

§Examples
use elements_rs::Element;

let atomic_number: u8 = Element::H.into();
assert_eq!(atomic_number, 1);

let oxygen: u8 = Element::O.into();
assert_eq!(oxygen, 8);
Source§

impl From<ErbiumIsotope> for Element

Source§

fn from(_isotope: ErbiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<EuropiumIsotope> for Element

Source§

fn from(_isotope: EuropiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<FermiumIsotope> for Element

Source§

fn from(_isotope: FermiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<FleroviumIsotope> for Element

Source§

fn from(_isotope: FleroviumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<FluorineIsotope> for Element

Source§

fn from(_isotope: FluorineIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<FranciumIsotope> for Element

Source§

fn from(_isotope: FranciumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<GadoliniumIsotope> for Element

Source§

fn from(_isotope: GadoliniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<GalliumIsotope> for Element

Source§

fn from(_isotope: GalliumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<GermaniumIsotope> for Element

Source§

fn from(_isotope: GermaniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<GoldIsotope> for Element

Source§

fn from(_isotope: GoldIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<HafniumIsotope> for Element

Source§

fn from(_isotope: HafniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<HassiumIsotope> for Element

Source§

fn from(_isotope: HassiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<HeliumIsotope> for Element

Source§

fn from(_isotope: HeliumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<HolmiumIsotope> for Element

Source§

fn from(_isotope: HolmiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<HydrogenIsotope> for Element

Source§

fn from(_isotope: HydrogenIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<IndiumIsotope> for Element

Source§

fn from(_isotope: IndiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<IodineIsotope> for Element

Source§

fn from(_isotope: IodineIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<IridiumIsotope> for Element

Source§

fn from(_isotope: IridiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<IronIsotope> for Element

Source§

fn from(_isotope: IronIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<KryptonIsotope> for Element

Source§

fn from(_isotope: KryptonIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<LanthanumIsotope> for Element

Source§

fn from(_isotope: LanthanumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<LawrenciumIsotope> for Element

Source§

fn from(_isotope: LawrenciumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<LeadIsotope> for Element

Source§

fn from(_isotope: LeadIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<LithiumIsotope> for Element

Source§

fn from(_isotope: LithiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<LivermoriumIsotope> for Element

Source§

fn from(_isotope: LivermoriumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<LutetiumIsotope> for Element

Source§

fn from(_isotope: LutetiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<MagnesiumIsotope> for Element

Source§

fn from(_isotope: MagnesiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ManganeseIsotope> for Element

Source§

fn from(_isotope: ManganeseIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<MeitneriumIsotope> for Element

Source§

fn from(_isotope: MeitneriumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<MendeleviumIsotope> for Element

Source§

fn from(_isotope: MendeleviumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<MercuryIsotope> for Element

Source§

fn from(_isotope: MercuryIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<MolybdenumIsotope> for Element

Source§

fn from(_isotope: MolybdenumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<MoscoviumIsotope> for Element

Source§

fn from(_isotope: MoscoviumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<NeodymiumIsotope> for Element

Source§

fn from(_isotope: NeodymiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<NeonIsotope> for Element

Source§

fn from(_isotope: NeonIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<NeptuniumIsotope> for Element

Source§

fn from(_isotope: NeptuniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<NickelIsotope> for Element

Source§

fn from(_isotope: NickelIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<NihoniumIsotope> for Element

Source§

fn from(_isotope: NihoniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<NiobiumIsotope> for Element

Source§

fn from(_isotope: NiobiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<NitrogenIsotope> for Element

Source§

fn from(_isotope: NitrogenIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<NobeliumIsotope> for Element

Source§

fn from(_isotope: NobeliumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<OganessonIsotope> for Element

Source§

fn from(_isotope: OganessonIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<OsmiumIsotope> for Element

Source§

fn from(_isotope: OsmiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<OxygenIsotope> for Element

Source§

fn from(_isotope: OxygenIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<PalladiumIsotope> for Element

Source§

fn from(_isotope: PalladiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<PhosphorusIsotope> for Element

Source§

fn from(_isotope: PhosphorusIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<PlatinumIsotope> for Element

Source§

fn from(_isotope: PlatinumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<PlutoniumIsotope> for Element

Source§

fn from(_isotope: PlutoniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<PoloniumIsotope> for Element

Source§

fn from(_isotope: PoloniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<PotassiumIsotope> for Element

Source§

fn from(_isotope: PotassiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<PraseodymiumIsotope> for Element

Source§

fn from(_isotope: PraseodymiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<PromethiumIsotope> for Element

Source§

fn from(_isotope: PromethiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ProtactiniumIsotope> for Element

Source§

fn from(_isotope: ProtactiniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<RadiumIsotope> for Element

Source§

fn from(_isotope: RadiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<RadonIsotope> for Element

Source§

fn from(_isotope: RadonIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<RheniumIsotope> for Element

Source§

fn from(_isotope: RheniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<RhodiumIsotope> for Element

Source§

fn from(_isotope: RhodiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<RoentgeniumIsotope> for Element

Source§

fn from(_isotope: RoentgeniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<RubidiumIsotope> for Element

Source§

fn from(_isotope: RubidiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<RutheniumIsotope> for Element

Source§

fn from(_isotope: RutheniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<RutherfordiumIsotope> for Element

Source§

fn from(_isotope: RutherfordiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<SamariumIsotope> for Element

Source§

fn from(_isotope: SamariumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ScandiumIsotope> for Element

Source§

fn from(_isotope: ScandiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<SeaborgiumIsotope> for Element

Source§

fn from(_isotope: SeaborgiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<SeleniumIsotope> for Element

Source§

fn from(_isotope: SeleniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<SiliconIsotope> for Element

Source§

fn from(_isotope: SiliconIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<SilverIsotope> for Element

Source§

fn from(_isotope: SilverIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<SodiumIsotope> for Element

Source§

fn from(_isotope: SodiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<StrontiumIsotope> for Element

Source§

fn from(_isotope: StrontiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<SulfurIsotope> for Element

Source§

fn from(_isotope: SulfurIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<TantalumIsotope> for Element

Source§

fn from(_isotope: TantalumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<TechnetiumIsotope> for Element

Source§

fn from(_isotope: TechnetiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<TelluriumIsotope> for Element

Source§

fn from(_isotope: TelluriumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<TennessineIsotope> for Element

Source§

fn from(_isotope: TennessineIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<TerbiumIsotope> for Element

Source§

fn from(_isotope: TerbiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ThalliumIsotope> for Element

Source§

fn from(_isotope: ThalliumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ThoriumIsotope> for Element

Source§

fn from(_isotope: ThoriumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ThuliumIsotope> for Element

Source§

fn from(_isotope: ThuliumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<TinIsotope> for Element

Source§

fn from(_isotope: TinIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<TitaniumIsotope> for Element

Source§

fn from(_isotope: TitaniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<TungstenIsotope> for Element

Source§

fn from(_isotope: TungstenIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<UraniumIsotope> for Element

Source§

fn from(_isotope: UraniumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<VanadiumIsotope> for Element

Source§

fn from(_isotope: VanadiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<XenonIsotope> for Element

Source§

fn from(_isotope: XenonIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<YtterbiumIsotope> for Element

Source§

fn from(_isotope: YtterbiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<YttriumIsotope> for Element

Source§

fn from(_isotope: YttriumIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ZincIsotope> for Element

Source§

fn from(_isotope: ZincIsotope) -> Self

Converts to this type from the input type.
Source§

impl From<ZirconiumIsotope> for Element

Source§

fn from(_isotope: ZirconiumIsotope) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Element> for ElementMask

Source§

fn from_iter<T: IntoIterator<Item = Element>>(iter: T) -> Self

§Examples
use elements_rs::{Element, ElementMask};

let elements = alloc::vec![Element::H, Element::He];
let mask: ElementMask = elements.into_iter().collect();
assert!(mask.contains(Element::H));
assert!(mask.contains(Element::He));
Source§

impl FromStr for Element

Source§

fn from_str(value: &str) -> Result<Self, Self::Err>

Parses an element from its symbol string.

Parses element symbols into Element variants.

§Examples
use elements_rs::Element;

let hydrogen: Element = "H".parse().unwrap();
assert_eq!(hydrogen, Element::H);

let oxygen: Element = "O".parse().unwrap();
assert_eq!(oxygen, Element::O);

let carbon: Element = "C".parse().unwrap();
assert_eq!(carbon, Element::C);
Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl Hash for Element

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for Element

Source§

impl IsotopicComposition for Element

Source§

fn isotopic_composition(&self) -> Option<f64>

Returns None for isotopes without stable natural occurrence. Read more
Source§

impl Ord for Element

Source§

fn cmp(&self, other: &Element) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Element

Source§

fn eq(&self, other: &Element) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Element

Source§

fn partial_cmp(&self, other: &Element) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PrincipalQuantumNumber for Element

Source§

fn principal_quantum_number(&self) -> u8

Returns the principal quantum number (shell number). Read more
Source§

impl RelativeAtomicMass for Element

Source§

fn relative_atomic_mass(&self) -> f64

Returns the relative atomic mass in daltons (Da). Read more
Source§

impl Serialize for Element

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<&str> for Element

Source§

fn try_from(value: &str) -> Result<Self, Self::Error>

Parses element symbols from string slices.

§Examples
use elements_rs::Element;

let oxygen = Element::try_from("O").unwrap();
assert_eq!(oxygen, Element::O);

let magnesium = Element::try_from("Mg").unwrap();
assert_eq!(magnesium, Element::Mg);
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<[char; 2]> for Element

Source§

fn try_from(value: [char; 2]) -> Result<Self, Self::Error>

Parses two-character element symbols.

§Examples
use elements_rs::Element;

let helium = Element::try_from(['H', 'e']).unwrap();
assert_eq!(helium, Element::He);

let lithium = Element::try_from(['L', 'i']).unwrap();
assert_eq!(lithium, Element::Li);
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Element> for [char; 2]

Source§

fn try_from(value: Element) -> Result<Self, Self::Error>

Converts an element to its symbol as a character array.

Single-character symbols are padded with a space.

§Examples
use elements_rs::Element;

let hydrogen_chars: [char; 2] = Element::H.try_into().unwrap();
assert_eq!(hydrogen_chars, ['H', ' ']);

let helium_chars: [char; 2] = Element::He.try_into().unwrap();
assert_eq!(helium_chars, ['H', 'e']);
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Element> for char

Source§

fn try_from(value: Element) -> Result<Self, Self::Error>

Converts an element to its single-character symbol.

This only works for elements with single-character symbols. For elements with two-character symbols, this returns an error.

§Examples
use elements_rs::Element;

let hydrogen_char: char = Element::H.try_into().unwrap();
assert_eq!(hydrogen_char, 'H');

let carbon_char: char = Element::C.try_into().unwrap();
assert_eq!(carbon_char, 'C');

// This will fail for two-character symbols
let helium_result: Result<char, _> = Element::He.try_into();
assert!(helium_result.is_err());
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<char> for Element

Source§

fn try_from(value: char) -> Result<Self, Self::Error>

Parses single-character element symbols.

§Implementation details

It supports both uppercase and lowercase letters since, while in chemical formulas element symbols are capitalized, in other contexts such as SMILES strings they may appear in lowercase to represent aromatic atoms.

§Examples
use elements_rs::Element;

let hydrogen = Element::try_from('H').unwrap();
assert_eq!(hydrogen, Element::H);

let carbon = Element::try_from('C').unwrap();
assert_eq!(carbon, Element::C);
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<u8> for Element

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(atomic_number: u8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl ValenceElectrons for Element

Source§

fn valence_electrons(&self) -> u8

Returns the number of valence electrons. Read more
Source§

impl Copy for Element

Source§

impl Eq for Element

Source§

impl StructuralPartialEq for Element

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,