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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! [`DatasetInfo`] — the format-agnostic metadata descriptor.
//!
//! Every opened dataset carries one: [`Dataset::info`](crate::Dataset::info)
//! returns a reference to it, and each
//! [`OpenedDataset`](crate::open::OpenedDataset) variant wraps one. It is the
//! single place where "what is this file?" is answered without touching pixels
//! or features.
use crate::;
/// Basic dataset metadata — analogous to `GDALDataset` info.
///
/// # Constructing a `DatasetInfo`
///
/// This struct is `#[non_exhaustive]`, so new fields can be added in future
/// releases without breaking downstream code. The cost of that guarantee is
/// that struct-expression construction is unavailable outside this crate —
/// **including** the functional-update form:
///
/// ```rust,compile_fail
/// use oxigeo::{DatasetFormat, DatasetInfo};
///
/// // error[E0639]: cannot create non-exhaustive struct using struct expression
/// let info = DatasetInfo {
/// format: DatasetFormat::GeoTiff,
/// ..DatasetInfo::default()
/// };
/// ```
///
/// Start from [`DatasetInfo::default()`](Default::default) — an
/// "everything unknown" descriptor — and assign the fields you care about.
/// Fields you do not touch keep their default, so adding a field upstream can
/// never break this pattern:
///
/// ```rust
/// use oxigeo::{DatasetFormat, DatasetInfo, RasterDataType};
///
/// let mut info = DatasetInfo::default();
/// info.format = DatasetFormat::GeoTiff;
/// info.width = Some(1024);
/// info.height = Some(768);
/// info.band_count = 3;
/// info.data_type = Some(RasterDataType::UInt16);
///
/// assert_eq!(info.layer_count, 0); // untouched fields keep their default
/// ```