Function photosynthesis::synthesize[][src]

pub fn synthesize(molecules: Vec<Molecules>) -> MoleculeSet

Synthesize the molecules to return a new set of molecules.

If no match is found for the given molecules, the set will remain the same.

The ordering of the input is unimportant.

It is assumed that sunlight is applied, otherwise the reaction can not occur.


use photosynthesis::{Molecules, Molecule, synthesize};
let mut input = Vec::new();
input.push(Molecules::new(Molecule::CarbonDioxide, 6));
input.push(Molecules::new(Molecule::Water, 6));
let result = synthesize(input);

let glucose = Molecules::new(Molecule::Glucose, 1);
assert_eq!(true, result.contains(&glucose));