use crate::for_all_versions;
macro_rules! impl_codeable_concept {
($version:ident) => {
mod $version {
use $crate::$version::types::CodeableConcept;
impl CodeableConcept {
pub fn codes_with_system<'a, 'b>(
&'a self,
system: &'b str,
) -> impl Iterator<Item = &'a str> + Send + 'b
where
'a: 'b,
{
self.coding
.iter()
.flatten()
.filter(|coding| coding.system.as_deref() == Some(system))
.filter_map(|coding| coding.code.as_deref())
}
#[must_use]
pub fn code_with_system<'a>(&'a self, system: &str) -> Option<&'a str> {
self.codes_with_system(system).next()
}
}
}
};
}
for_all_versions!(impl_codeable_concept);