Skip to main content

datex_core/values/value/
iter_parts.rs

1use crate::{
2    prelude::*,
3    traits::iter_parts::IterParts,
4    values::{
5        value::Value,
6        value_container::borrowed_value_container::{
7            BorrowedValueContainer, BorrowedValueContainerMut,
8        },
9    },
10};
11
12impl IterParts for Value {
13    fn iter_list_parts<'a>(
14        &'a self,
15    ) -> Option<Box<dyn Iterator<Item = BorrowedValueContainer<'a>> + 'a>> {
16        match self {
17            Value::Core(core_value) => core_value.iter_list_parts(),
18            Value::Native(native_value) => native_value.iter_list_parts(),
19        }
20    }
21    fn iter_list_parts_mut<'a>(
22        &'a mut self,
23    ) -> Option<Box<dyn Iterator<Item = BorrowedValueContainerMut<'a>> + 'a>>
24    {
25        match self {
26            Value::Core(core_value) => core_value.iter_list_parts_mut(),
27            Value::Native(native_value) => native_value.iter_list_parts_mut(),
28        }
29    }
30    fn iter_map_parts<'a>(
31        &'a self,
32    ) -> Option<
33        Box<
34            dyn Iterator<
35                    Item = (
36                        BorrowedValueContainer<'a>,
37                        BorrowedValueContainer<'a>,
38                    ),
39                > + 'a,
40        >,
41    > {
42        match self {
43            Value::Core(core_value) => core_value.iter_map_parts(),
44            Value::Native(native_value) => native_value.iter_map_parts(),
45        }
46    }
47
48    fn iter_map_parts_mut<'a>(
49        &'a mut self,
50    ) -> Option<
51        Box<
52            dyn Iterator<
53                    Item = (
54                        BorrowedValueContainer<'a>,
55                        BorrowedValueContainerMut<'a>,
56                    ),
57                > + 'a,
58        >,
59    > {
60        match self {
61            Value::Core(core_value) => core_value.iter_map_parts_mut(),
62            Value::Native(native_value) => native_value.iter_map_parts_mut(),
63        }
64    }
65}