Debian Codegraph @

src/isotope/display.rs

raw symbols SCIP
1 use craterust-analyzer cargo mendeleev 0.8.1 crate/::superscriptrust-analyzer cargo mendeleev 0.8.1 superscript/::Superscriptrust-analyzer cargo mendeleev 0.8.1 superscript/Superscript#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!, stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#};
3
4 use superrust-analyzer cargo mendeleev 0.8.1 isotope/::Isotoperust-analyzer cargo mendeleev 0.8.1 isotope/Isotope#;
5
6 impl Isotoperust-analyzer cargo mendeleev 0.8.1 isotope/Isotope# {
7 /// Returns the isotope represented as a string using the
8 /// element's name in English and the mass number.
9 ///
10 /// ```
11 /// use mendeleev::Isotope;
12 /// assert_eq!(Isotope::H1.display_with_name(), "Hydrogen-1");
13 /// ```
14 pub fn display_with_namerust-analyzer cargo mendeleev 0.8.1 isotope/display/impl#[Isotope]display_with_name().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
15 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}-{}", self.elementrust-analyzer cargo mendeleev 0.8.1 properties/isotopes/element/impl#[Isotope]element().().namerust-analyzer cargo mendeleev 0.8.1 properties/name/impl#[Element]name().(), self.mass_numberrust-analyzer cargo mendeleev 0.8.1 properties/isotopes/mass_number/impl#[Isotope]mass_number().())
16 }
17
18 /// Returns the isotope represented as a string using the
19 /// element's chemical symbol and the mass number.
20 ///
21 /// ```
22 /// use mendeleev::Isotope;
23 /// assert_eq!(Isotope::H1.display_with_symbol(), "H-1");
24 /// ```
25 pub fn display_with_symbolrust-analyzer cargo mendeleev 0.8.1 isotope/display/impl#[Isotope]display_with_symbol().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
26 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}-{}", self.elementrust-analyzer cargo mendeleev 0.8.1 properties/isotopes/element/impl#[Isotope]element().().symbolrust-analyzer cargo mendeleev 0.8.1 properties/symbol/impl#[Element]symbol().(), self.mass_numberrust-analyzer cargo mendeleev 0.8.1 properties/isotopes/mass_number/impl#[Isotope]mass_number().())
27 }
28
29 /// Returns the isotope represented as a string using the
30 /// element's chemical symbol and the mass number as a UTF-8\
31 /// superscript.
32 ///
33 /// ```
34 /// use mendeleev::Isotope;
35 /// assert_eq!(Isotope::H1.display_with_superscript(), "¹H");
36 /// ```
37 pub fn display_with_superscriptrust-analyzer cargo mendeleev 0.8.1 isotope/display/impl#[Isotope]display_with_superscript().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
38 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
39 "{}{}",
40 Superscriptrust-analyzer cargo mendeleev 0.8.1 superscript/Superscript#::newrust-analyzer cargo mendeleev 0.8.1 superscript/impl#[Superscript]new().(self.mass_numberrust-analyzer cargo mendeleev 0.8.1 properties/isotopes/mass_number/impl#[Isotope]mass_number().()),
41 self.elementrust-analyzer cargo mendeleev 0.8.1 properties/isotopes/element/impl#[Isotope]element().().symbolrust-analyzer cargo mendeleev 0.8.1 properties/symbol/impl#[Element]symbol().()
42 )
43 }
44 }