Skip to main content

git_harvest/changelog/
section.rs

1/*********************** GNU General Public License 3.0 ***********************\
2|                                                                              |
3|  Copyright (C) 2026 Kevin Matthes                                            |
4|                                                                              |
5|  This program is free software: you can redistribute it and/or modify        |
6|  it under the terms of the GNU General Public License as published by        |
7|  the Free Software Foundation, either version 3 of the License, or           |
8|  (at your option) any later version.                                         |
9|                                                                              |
10|  This program is distributed in the hope that it will be useful,             |
11|  but WITHOUT ANY WARRANTY; without even the implied warranty of              |
12|  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
13|  GNU General Public License for more details.                                |
14|                                                                              |
15|  You should have received a copy of the GNU General Public License           |
16|  along with this program.  If not, see <https://www.gnu.org/licenses/>.      |
17|                                                                              |
18\******************************************************************************/
19
20//! One released, or pending, version of the CHANGELOG.
21
22/// One section of the CHANGELOG:  the changes of a single version.
23///
24/// A section with no `released` moment is the pending, not-yet-published one.
25/// `changes` maps a bucket name to its entries, in the order they render.
26#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
27pub struct Section {
28    /// The version this section documents, as a `(major, minor, patch)`
29    /// triple in the RON.
30    #[serde(with = "super::version")]
31    pub version: semver::Version,
32
33    /// The moment this version was published, or `None` while pending.
34    pub released: Option<chrono::DateTime<chrono::Utc>>,
35
36    /// An optional prose lead for this version.
37    pub introduction: Option<String>,
38
39    /// Link labels used by this section, mapped to their targets.
40    pub references: std::collections::BTreeMap<String, String>,
41
42    /// The entries of this section, keyed by bucket.
43    pub changes: std::collections::BTreeMap<String, Vec<crate::Entry>>,
44}
45
46/******************************************************************************/