Struct Nuclide
pub struct Nuclide {
pub symbol: String,
pub isotope: u16,
pub state: IsomerState,
}
Expand description
Definition for a particular nuclide
The TryFrom
trait is implemented for core string types and will try to
parse them into a nuclide.
Expects <element><separator><isotope><metastable>
at most but only the
element is required. e.g.
- Element only => Co, C
- Isotope => Co60, C12
- Metastable => Co60m1 Co60m2 Co60m3 …
- Fispact => Co60m Co60n Co60mo
This order must be enforced because something like “104mn” is ambiguous. i.e. should it be interpreted as Mn-104 or N-104m?
Note that the metastable state should be the ENSDF notation (m1, m2, m3, etc…).
The metastable symbol can be converted from anything ending with the FISPACT-II notation of m, n, etc…, but it can not be guaranteed that this is a 1:1 mapping.
// Get the variant from an IAEA symbol
assert_eq!(
Nuclide::try_from("eu-152m2").unwrap(),
Nuclide {
symbol: "Eu".to_string(),
isotope: 152,
state: IsomerState::Excited(2)
}
);
Fields§
§symbol: String
Element
isotope: u16
Isotope number (Z+N, total nucleons)
state: IsomerState
Excited state status
Implementations§
§impl Nuclide
impl Nuclide
pub fn name(&self) -> String
pub fn name(&self) -> String
A basic name for the nuclide
The nuclide name will be formatted as <element><isotope number>
to provide a display name with consistent formatting.
For example:
let mut nuclide = Nuclide {
symbol: "eu".to_string(),
isotope: 152,
state: IsomerState::Ground
};
// Get a display name for the nuclide
assert_eq!(nuclide.name(), "Eu152");
pub fn name_with_state(&self) -> String
pub fn name_with_state(&self) -> String
A name for the nuclide including isomer state
The nuclide name will be formatted as <element><isotope number><state>
For example:
let nuclide = Nuclide {
symbol: "eu".to_string(),
isotope: 152,
state: IsomerState::Excited(1)
};
// Get a display name for the excited nuclide
assert_eq!(nuclide.name_with_state(), "Eu152m1");
pub fn query_name(&self) -> Result<String, Error>
pub fn query_name(&self) -> Result<String, Error>
Name formatted for IAEA queries
The IAEA API expects the nuclide as <mass><element>
with no state
information.
Calls to this method for elements (i.e. mass set to 0) will return an error.
For example:
let nuclide = Nuclide {
symbol: "eu".to_string(),
isotope: 152,
state: IsomerState::Excited(1)
};
// Get the format expected for the IAEA API query
assert_eq!(nuclide.query_name().unwrap(), "152eu");
Trait Implementations§
§impl<'de> Deserialize<'de> for Nuclide
impl<'de> Deserialize<'de> for Nuclide
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Nuclide, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Nuclide, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Ord for Nuclide
impl Ord for Nuclide
§impl PartialOrd for Nuclide
impl PartialOrd for Nuclide
impl Eq for Nuclide
impl StructuralPartialEq for Nuclide
Auto Trait Implementations§
impl Freeze for Nuclide
impl RefUnwindSafe for Nuclide
impl Send for Nuclide
impl Sync for Nuclide
impl Unpin for Nuclide
impl UnwindSafe for Nuclide
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.