wrap brain around Copy,Clone,Reference of the Element type

This commit is contained in:
fabolous005 2023-11-22 23:44:49 +01:00
parent fe974adddb
commit a832375716
3 changed files with 6 additions and 6 deletions

View File

@ -13,8 +13,8 @@ use crate::variations::calculate::get_variations;
#[derive(Debug)] #[derive(Debug)]
pub struct ElementNr<'a> { pub struct ElementNr {
element : &'a Element, element : &'static Element,
nr : u32 nr : u32
} }

View File

@ -2,7 +2,7 @@ use periodic_table::Element;
use crate::ElementNr; use crate::ElementNr;
pub fn parse(arg: &String) -> Vec<ElementNr<'static>> { pub fn parse(arg: &String) -> Vec<ElementNr> {
let mut char_before: Option<char> = None; let mut char_before: Option<char> = None;
let mut element: Option<&Element> = None; let mut element: Option<&Element> = None;
let mut element_line: Vec<ElementNr> = vec![]; let mut element_line: Vec<ElementNr> = vec![];

View File

@ -2,11 +2,11 @@ use periodic_table::Element;
use crate::ElementNr; use crate::ElementNr;
pub struct Variation { pub struct Variation<'a> {
longest: Element longest: &'a ElementNr,
} }
pub fn get_variations(elements: Vec<ElementNr>) -> Vec<Variation> { pub fn get_variations(elements: Vec<ElementNr>) -> Vec<Variation<'static>> {
let mut variations: Vec<Variation> = vec![]; let mut variations: Vec<Variation> = vec![];
variations variations