gnss_qc/context/
blob.rs

1use crate::prelude::Rinex;
2
3#[cfg(feature = "sp3")]
4use crate::prelude::SP3;
5
6#[derive(Clone)]
7pub enum BlobData {
8    /// [Rinex] content
9    RINEX(Rinex),
10    #[cfg(feature = "sp3")]
11    /// [SP3] content
12    SP3(SP3),
13}
14
15impl BlobData {
16    /// Returns reference to underlying [Rinex] data
17    pub fn as_rinex(&self) -> Option<&Rinex> {
18        match self {
19            Self::RINEX(r) => Some(r),
20            #[cfg(feature = "sp3")]
21            _ => None,
22        }
23    }
24
25    /// Returns mutable reference to underlying [Rinex] data
26    pub fn as_mut_rinex(&mut self) -> Option<&mut Rinex> {
27        match self {
28            Self::RINEX(r) => Some(r),
29            #[cfg(feature = "sp3")]
30            _ => None,
31        }
32    }
33}
34
35/// Returns reference to inner SP3 data.
36#[cfg(feature = "sp3")]
37#[cfg_attr(docsrs, doc(cfg(feature = "sp3")))]
38impl BlobData {
39    /// Returns reference to underlying [SP3] data
40    pub fn as_sp3(&self) -> Option<&SP3> {
41        match self {
42            Self::SP3(s) => Some(s),
43            _ => None,
44        }
45    }
46
47    /// Returns mutable reference to underlying [SP3] data
48    pub fn as_mut_sp3(&mut self) -> Option<&mut SP3> {
49        match self {
50            Self::SP3(s) => Some(s),
51            _ => None,
52        }
53    }
54}