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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
//! Ephemeris computation results.
//!
//! [`EphemerisResult<T>`] is the return type of
//! [`OrbitalElements::compute`](crate::OrbitalElements::compute).
//! It holds a flat sequence of [`EphemerisEntry<T>`] values, each pairing an
//! epoch, the observer for which the computation was requested, and the
//! per-epoch result (`Ok` or `Err`).
//!
//! Errors are collected *per entry*: a failure at one epoch does not prevent
//! the remaining epochs or observers from being computed. The total entry
//! count always equals the sum of epochs generated across all observers in
//! the request.
//!
//! # Iteration
//!
//! ```rust,ignore
//! for entry in &result {
//! match &entry.result {
//! Ok(pos) => println!("{} {:?}: RA={:.4}", entry.epoch, entry.observer.name, pos.coord.ra),
//! Err(e) => eprintln!("{} {:?}: {e}", entry.epoch, entry.observer.name),
//! }
//! }
//! ```
//!
//! Three focused convenience iterators narrow the view:
//!
//! - [`EphemerisResult::successes`] — only entries whose result is `Ok`.
//! - [`EphemerisResult::errors`] — only entries whose result is `Err`.
//! - [`EphemerisResult::by_observer`] — only entries for a specific observer.
use Epoch;
use Observer;
use crateOutfitError;
// ---------------------------------------------------------------------------
// EphemerisEntry
// ---------------------------------------------------------------------------
/// A single row in an [`EphemerisResult`]: one `(epoch, observer, result)`.
///
/// The `observer` field records which site was used for this computation,
/// which is essential when a request spans several observers.
///
/// # Ordering
///
/// Entries follow the order in which observers were added to the request: all
/// epochs for the first observer appear first, then all epochs for the second
/// observer, and so on. Within each observer the epoch order matches the
/// [`EphemerisMode`](super::request::EphemerisMode) used for that observer.
// ---------------------------------------------------------------------------
// EphemerisResult
// ---------------------------------------------------------------------------
/// The result of an [`EphemerisRequest`](super::request::EphemerisRequest)
/// computation.
///
/// Contains one [`EphemerisEntry`] per `(epoch, observer)` pair generated by
/// the request. Use [`successes`](Self::successes), [`errors`](Self::errors),
/// or [`by_observer`](Self::by_observer) to filter the entries, or iterate
/// over all of them with [`iter`](Self::iter) or the [`IntoIterator`] impl.
///
/// # Example
///
/// ```rust,ignore
/// let result = elements.compute(&request, &jpl, &ut1);
///
/// println!("{} entries, {} errors", result.len(), result.error_count());
///
/// for entry in result.successes() {
/// println!("{}: {:?}", entry.epoch, entry.result);
/// }
/// ```
// ---------------------------------------------------------------------------
// IntoIterator
// ---------------------------------------------------------------------------
/// Consuming iterator over all entries in order.
/// Borrowing iterator over all entries in order.