git-bug 0.2.4

A rust library for interfacing with git-bug repositories
Documentation
// git-bug-rs - A rust library for interfacing with git-bug repositories
//
// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
// SPDX-License-Identifier: GPL-3.0-or-later
//
// This file is part of git-bug-rs/git-gub.
//
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/agpl.txt>.

//! [`HistorySteps`][`HistoryStep`] are the separate items that compose a
//! [`Timeline`][`super::Timeline`].

use crate::replica::entity::{identity::IdentityStub, timestamp::TimeStamp};

/// A trait that every [`Entity::HistoryStep`][`crate::replica::entity::Entity::HistoryStep`]
/// needs to implement.
pub trait HistoryStep {
    /// Return the author of this step in history.
    fn author(&self) -> IdentityStub;

    /// Return the UNIX time stamp of this step
    fn at(&self) -> TimeStamp;

    /// Return the UNIX time stamp of this step
    ///
    /// # Note
    /// This is just an alias for [`HistoryStep::at`].
    fn timestamp(&self) -> TimeStamp {
        self.at()
    }
}