mlt_core/frames/v01/geometry/
analyze.rs1use crate::analyse::{Analyze, StatType};
2use crate::v01::{EncodedGeometry, GeometryType, GeometryValues, RawGeometry, StreamMeta};
3
4impl Analyze for EncodedGeometry {
5 fn for_each_stream(&self, cb: &mut dyn FnMut(StreamMeta)) {
6 self.meta.for_each_stream(cb);
7 self.items.for_each_stream(cb);
8 }
9}
10
11impl Analyze for RawGeometry<'_> {
12 fn for_each_stream(&self, cb: &mut dyn FnMut(StreamMeta)) {
13 self.meta.for_each_stream(cb);
14 self.items.for_each_stream(cb);
15 }
16}
17
18impl Analyze for GeometryValues {
19 fn collect_statistic(&self, stat: StatType) -> usize {
20 match stat {
21 StatType::DecodedDataSize => {
22 self.vector_types.collect_statistic(stat)
23 + self.geometry_offsets.collect_statistic(stat)
24 + self.part_offsets.collect_statistic(stat)
25 + self.ring_offsets.collect_statistic(stat)
26 + self.index_buffer.collect_statistic(stat)
27 + self.triangles.collect_statistic(stat)
28 + self.vertices.collect_statistic(stat)
29 }
30 StatType::DecodedMetaSize => 0,
31 StatType::FeatureCount => self.vector_types.len(),
32 }
33 }
34}
35
36impl Analyze for GeometryType {
37 fn collect_statistic(&self, _stat: StatType) -> usize {
38 size_of::<Self>()
39 }
40}