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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use crate::error::Result;
use crate::geometry_processor::GeomProcessor;
use crate::property_processor::PropertyProcessor;
/// Feature processing trait
#[allow(unused_variables)]
pub trait FeatureProcessor: GeomProcessor + PropertyProcessor {
/// Begin of dataset processing
///
/// ## Invariants
///
/// - `dataset_begin` is called _only once_ for an entire dataset.
/// - `dataset_begin` is called before all other methods, including `feature_begin`,
/// `properties_begin`, `geometry_begin`, and all methods from [`GeomProcessor`] and
/// [`PropertyProcessor`]
fn dataset_begin(&mut self, name: Option<&str>) -> Result<()> {
Ok(())
}
/// End of dataset processing
///
/// ## Invariants
///
/// - `dataset_end` is called _only once_ for an entire dataset.
/// - No other methods may be called after `dataset_end`.
fn dataset_end(&mut self) -> Result<()> {
Ok(())
}
/// Begin of feature processing
///
/// - `idx`: the positional row index in the dataset. For the `n`th row, `idx` will be
/// `n`.
/// - `feature_begin` will be called before both `properties_begin` and `geometry_begin`.
fn feature_begin(&mut self, idx: u64) -> Result<()> {
Ok(())
}
/// End of feature processing
///
/// - `idx`: the positional row index in the dataset. For the `n`th row, `idx` will be
/// `n`.
/// - `feature_end` will be called after both `properties_end` and `geometry_end`.
fn feature_end(&mut self, idx: u64) -> Result<()> {
Ok(())
}
/// Begin of feature property processing
///
/// ## Invariants
///
/// - `properties_begin` will not be called a second time before `properties_end` is called.
fn properties_begin(&mut self) -> Result<()> {
Ok(())
}
/// End of feature property processing
fn properties_end(&mut self) -> Result<()> {
Ok(())
}
/// Begin of feature geometry processing
///
/// ## Following events
///
/// - Relevant methods from [`GeomProcessor`] will be called for each geometry.
fn geometry_begin(&mut self) -> Result<()> {
Ok(())
}
/// End of feature geometry processing
fn geometry_end(&mut self) -> Result<()> {
Ok(())
}
}