rustronomy_core/meta/
auto.rs

1/*
2  Copyright© 2023 Raúl Wolters(1)
3
4  This file is part of rustronomy-core.
5
6  rustronomy is free software: you can redistribute it and/or modify it under
7  the terms of the European Union Public License version 1.2 or later, as
8  published by the European Commission.
9
10  rustronomy is distributed in the hope that it will be useful, but WITHOUT ANY
11  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12  A PARTICULAR PURPOSE. See the European Union Public License for more details.
13
14  You should have received a copy of the EUPL in an/all official language(s) of
15  the European Union along with rustronomy.  If not, see 
16  <https://ec.europa.eu/info/european-union-public-licence_en/>.
17
18  (1) Resident of the Kingdom of the Netherlands; agreement between licensor and
19  licensee subject to Dutch law as per article 15 of the EUPL.
20*/
21
22use std::fmt::{Display, Debug, Formatter, Result};
23use super::MetaTag;
24
25#[derive(Debug, Clone, PartialEq)]
26/// Author responsible for data container
27pub struct Author(pub String);
28impl MetaTag for Author {}
29impl Display for Author {
30  fn fmt(&self, f: &mut Formatter<'_>) -> Result {
31    write!(f, "[Author]: \"{}\"", self.0)
32  }
33}
34
35#[derive(Debug, Clone, PartialEq)]
36/// Date of data collection
37pub struct CreationDate(pub chrono::DateTime<chrono::Utc>);
38impl MetaTag for CreationDate {}
39impl Display for CreationDate {
40  fn fmt(&self, f: &mut Formatter<'_>) -> Result {
41    write!(f, "[Creation date]: \"{}\"", self.0)
42  }
43}
44
45#[derive(Debug, Clone, PartialEq)]
46/// Date container was last modified
47pub struct LastModified(pub chrono::DateTime<chrono::Utc>);
48impl MetaTag for LastModified {}
49impl Display for LastModified {
50  fn fmt(&self, f: &mut Formatter<'_>) -> Result {
51    write!(f, "[Last modified date]: \"{}\"", self.0)
52  }
53}
54
55#[derive(Debug, Clone, PartialEq)]
56/// Organisation responsible for data container
57pub struct Organisation(pub String);
58impl MetaTag for Organisation {}
59impl Display for Organisation {
60  fn fmt(&self, f: &mut Formatter<'_>) -> Result {
61    write!(f, "[Organisation]: \"{}\"", self.0)
62  }
63}
64
65#[derive(Debug, Clone, PartialEq)]
66/// Telescope used to collect data (astronomy-specific)
67pub struct Telescope(pub String);
68impl MetaTag for Telescope {}
69impl Display for Telescope {
70  fn fmt(&self, f: &mut Formatter<'_>) -> Result {
71    write!(f, "[Telescope]: \"{}\"", self.0)
72  }
73}
74
75#[derive(Debug, Clone, PartialEq)]
76/// Instrument used to collect data (astronomy-specific)
77pub struct Instrument(pub String);
78impl MetaTag for Instrument {}
79impl Display for Instrument {
80  fn fmt(&self, f: &mut Formatter<'_>) -> Result {
81    write!(f, "[Instrument]: \"{}\"", self.0)
82  }
83}
84
85#[derive(Debug, Clone, PartialEq)]
86/// Observation target (astronomy-specific)
87pub struct Object(pub String);
88impl MetaTag for Object {}
89impl Display for Object {
90  fn fmt(&self, f: &mut Formatter<'_>) -> Result {
91    write!(f, "[Target object]: \"{}\"", self.0)
92  }
93}
94
95#[derive(Debug, Clone, PartialEq)]
96/// Exposure time in ms (astronomy-specific)
97pub struct ExposureTime(pub u64);
98impl MetaTag for ExposureTime {}
99impl Display for ExposureTime {
100  fn fmt(&self, f: &mut Formatter<'_>) -> Result {
101    write!(f, "[Exposure time (ms)]: \"{}\"", self.0)
102  }
103}