Skip to content

Commit 4b00650

Browse files
authored
Make polynomials public (#18)
Signed-off-by: Guillaume W. Bres <[email protected]>
1 parent bb69de2 commit 4b00650

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/processing/time/absolute.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ use super::Timeshift;
2121
/// - and [GnssAbsoluteTime::outdate_weekly] to discard [TimePolynomial]s published before that week
2222
#[derive(Default, Clone)]
2323
pub struct GnssAbsoluteTime {
24-
/// Internal [TimePolynomial]s
25-
polynomials: Vec<TimePolynomial>,
24+
pub polynomials: Vec<TimePolynomial>,
2625
}
2726

2827
impl GnssAbsoluteTime {
@@ -34,13 +33,13 @@ impl GnssAbsoluteTime {
3433
}
3534

3635
/// Discard [TimePolynomial]s that were published prior "now".
37-
/// You must have latched newer [TimePolynomial]s with [Self::add_polynomial] for the structure to remain valid.
36+
/// You must have latched newer [TimePolynomial]s for the structure to remain valid.
3837
pub fn outdate_past(&mut self, now: Epoch) {
3938
self.polynomials.retain(|poly| poly.ref_epoch > now);
4039
}
4140

4241
/// Discard [TimePolynomial]s that were published during past week from "now".
43-
/// You must have latched newer [TimePolynomial]s with [Self::add_polynomial] for the structure to remain valid.
42+
/// You must have latched newer [TimePolynomial]s for the structure to remain valid.
4443
pub fn outdate_weekly(&mut self, now: Epoch) {
4544
let new_week = now.to_time_of_week().0;
4645
self.polynomials.retain(|poly| {
@@ -49,12 +48,6 @@ impl GnssAbsoluteTime {
4948
});
5049
}
5150

52-
/// Add a new [TimePolynomial] to this management pool.
53-
/// Usually right after its publication.
54-
pub fn add_polynomial(&mut self, polynomial: TimePolynomial) {
55-
self.polynomials.push(polynomial);
56-
}
57-
5851
/// [Epoch] interpolation & correction attempt, into desired [TimeScale].
5952
pub fn precise_epoch_correction(&self, t: Epoch, target: TimeScale) -> Option<Epoch> {
6053
if t.time_scale == target {
@@ -245,7 +238,7 @@ impl Merge for GnssAbsoluteTime {
245238
fn merge_mut(&mut self, rhs: &Self) -> Result<(), MergeError> {
246239
// latch new polynomials
247240
for polynomial in rhs.polynomials.iter() {
248-
self.add_polynomial(*polynomial);
241+
self.polynomials.push(*polynomial);
249242
}
250243
Ok(())
251244
}

0 commit comments

Comments
 (0)