Skip to content
Snippets Groups Projects
lightdata.rs 915 B
Newer Older
use std::fmt::Display;
use uom::fmt::DisplayStyle::Abbreviation;
use uom::si::{energy::joule, f64::Energy};
use crate::spectrum::Spectrum;

#[derive(Debug, Clone)]
    Energy(DataEnergy),
    Geometric(DataGeometric),
impl Display for LightData {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            LightData::Energy(e) => {
                let ef = Energy::format_args(joule, Abbreviation);
                write!(
                    f,
                    "Energy: {}",
                    ef.with(Energy::new::<joule>(e.spectrum.total_energy()))
                )
            }
            _ => write!(f, "No display defined for this type of LightData"),
        }
    }
}
#[derive(Debug, Clone)]
pub struct DataEnergy {
    pub spectrum: Spectrum,
#[derive(Debug, Clone)]
pub struct DataGeometric {