git_bug/replica/entity/snapshot/timeline/history_step.rs
1// git-bug-rs - A rust library for interfacing with git-bug repositories
2//
3// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6// This file is part of git-bug-rs/git-gub.
7//
8// You should have received a copy of the License along with this program.
9// If not, see <https://www.gnu.org/licenses/agpl.txt>.
10
11//! [`HistorySteps`][`HistoryStep`] are the separate items that compose a
12//! [`Timeline`][`super::Timeline`].
13
14use crate::replica::entity::{identity::IdentityStub, timestamp::TimeStamp};
15
16/// A trait that every [`Entity::HistoryStep`][`crate::replica::entity::Entity::HistoryStep`]
17/// needs to implement.
18pub trait HistoryStep {
19 /// Return the author of this step in history.
20 fn author(&self) -> IdentityStub;
21
22 /// Return the UNIX time stamp of this step
23 fn at(&self) -> TimeStamp;
24
25 /// Return the UNIX time stamp of this step
26 ///
27 /// # Note
28 /// This is just an alias for [`HistoryStep::at`].
29 fn timestamp(&self) -> TimeStamp {
30 self.at()
31 }
32}