1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use serde::{Deserialize, Serialize};

use crate::DepthHistoryInterval;
use crate::DepthHistoryIntervals;
use crate::DepthHistoryMeta;

/*

*** Depth Hisory Scheme ***

{
		"intervals": DepthHistoryIntervals,
		"meta": DepthHistoryMeta
}
*/

#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct DepthHistory {
	intervals: DepthHistoryIntervals,
	meta: DepthHistoryMeta,
}

impl DepthHistory {
	#[must_use]
	pub const fn get_intervals(&self) -> &DepthHistoryIntervals {
		&self.intervals
	}

	#[must_use]
	pub const fn get_meta(&self) -> &DepthHistoryMeta {
		&self.meta
	}
}

impl IntoIterator for DepthHistory {
	type IntoIter = std::vec::IntoIter<Self::Item>;
	type Item = DepthHistoryInterval;

	fn into_iter(self) -> Self::IntoIter {
		self.intervals.into_iter()
	}
}