1use crate::for_all_versions;
4
5macro_rules! impl_codeable_concept {
7 ($version:ident) => {
8 mod $version {
9 use $crate::$version::types::CodeableConcept;
10
11 impl CodeableConcept {
12 pub fn codes_with_system<'a, 'b>(
14 &'a self,
15 system: &'b str,
16 ) -> impl Iterator<Item = &'a str> + Send + 'b
17 where
18 'a: 'b,
19 {
20 self.coding
21 .iter()
22 .flatten()
23 .filter(|coding| coding.system.as_deref() == Some(system))
24 .filter_map(|coding| coding.code.as_deref())
25 }
26
27 #[must_use]
29 pub fn code_with_system<'a>(&'a self, system: &str) -> Option<&'a str> {
30 self.codes_with_system(system).next()
31 }
32 }
33 }
34 };
35}
36for_all_versions!(impl_codeable_concept);