gnss_qc_traits/merge.rs
1//! Merge trait to extend datasets
2use thiserror::Error;
3
4#[cfg(docsrs)]
5use hifitime::TimeScale;
6
7/// [Merge] specific Errors.
8#[derive(Error, Debug)]
9pub enum Error {
10 /// Some File formats do not support the [Merge] operation
11 #[error("file type mismatch")]
12 MergeNotSupported,
13 /// You can only [Merge] two compatible files toghether.
14 #[error("file type mismatch")]
15 FileTypeMismatch,
16 /// Depending on file format, [Merge] may require that A & B be expressed
17 /// in the same [TimeScale]
18 #[error("timescale mismatch")]
19 TimescaleMismatch,
20 /// Depending on file format, [Merge] may require that A and B be expressed
21 /// in the same reference coordinates system.
22 #[error("reference frame mismatch")]
23 ReferenceFrameMismatch,
24 /// Depending on file format, [Merge] may require that A and B were produced
25 /// by the same data provider.
26 #[error("data provider mismatch")]
27 DataProviderMismatch,
28 /// Some file formats may require to have strictly the same dimensions
29 /// for [Merge] to be feasible.
30 #[error("dimensions mismatch")]
31 DimensionMismatch,
32 /// Other error that happend during [Merge] operation
33 #[error("other error")]
34 Other,
35}
36
37/// Merge Trait is impleted to extend Data Contexts.
38pub trait Merge {
39 /// Merge "rhs" dataset into self, to form extend dataset.
40 /// We use this for example to extend 24h RINEX to 1week RINEX.
41 /// When merging File A and B types must match otherwise operation is invalid.
42 fn merge(&self, rhs: &Self) -> Result<Self, Error>
43 where
44 Self: Sized;
45 /// [Self::merge] mutable implementation.
46 fn merge_mut(&mut self, rhs: &Self) -> Result<(), Error>;
47}