pub(crate) fn masses_by_config(
    cfg_masses: Option<&cfg::Masses>,
    elements: meta::SiteElements,
) -> FailResult<meta::SiteMasses>
{Ok({
    use crate::meta::Mass;

    elements.iter().cloned()
        .map(|element| match cfg_masses {
            Some(cfg::Masses(map)) => {
                map.get(element.symbol())
                    .cloned()
                    .map(Mass)
                    .ok_or_else(|| {
                        format_err!("No mass in config for element {}", element.symbol())
                    })
            },
            None => crate::common::default_element_mass(element),
        })
        .collect::<Result<Vec<_>, _>>()?.into()
})}
/// Implements the behavior of the `"masses"` config section.
///
/// When the section is omitted, default masses are used.
Implements the behavior of the `"masses"` config section.
When the section is omitted, default masses are used.
Implements the behavior of the ` " masses " ` config section . When the section is omitted default masses are used .
pub(crate) fn masses_by_config(
    cfg_masses: Option<&cfg::Masses>,
    elements: meta::SiteElements,
) -> FailResult<meta::SiteMasses>
{Ok({
    use crate::meta::Mass;
    elements.iter().cloned()
        .map(|element| match cfg_masses {
            Some(cfg::Masses(map)) => {
                map.get(element.symbol())
                    .cloned()
                    .map(Mass)
                    .ok_or_else(|| {
                        format_err!("No mass in config for element {}", element.symbol())
                    })
            },
            None => crate::common::default_element_mass(element),
        })
        .collect::<Result<Vec<_>, _>>()?.into()
})}
pub ( crate ) fn masses_by_config ( cfg_masses : Option < & cfg :: Masses > , elements : meta :: SiteElements , ) -> FailResult < meta :: SiteMasses > { Ok ( { use crate :: meta :: Mass ; elements . iter ( ) . cloned ( ) . map ( | element | match cfg_masses { Some ( cfg :: Masses ( map ) ) => { map . get ( element . symbol ( ) ) . cloned ( ) . map ( Mass ) . ok_or_else ( | | { format_err ! ( " " element symbol ( ) ) } ) } , None => crate :: common :: default_element_mass ( element ) , } ) . collect :: < Result < Vec < _ > , _ > > ( ) ? . into ( ) } ) }
Implements the behavior of the `"masses"` config section.
Implements the behavior of the ` " masses " ` config section .
cfg_masses
Option<&cfg::Masses>
elements
meta::SiteElements
cfg_masses
Option<&cfg::Masses>
elements
meta::SiteElements