eryon-mem 0.0.4

this crate implements the memory-related aspects of the eryon framework
/*
    appellation: header <module>
    authors: @FL03
*/
use super::BlockHeader;
use scsys::{Id, Timestamp};

impl BlockHeader {
    /// returns a new [`BlockHeader`] with the data
    pub const fn new(id: Id, timestamp: Timestamp) -> Self {
        Self { id, timestamp }
    }
    /// returns a new [`BlockHeader`] with the given id and the current timestamp
    pub fn from_id(id: Id) -> Self {
        Self {
            id,
            timestamp: Timestamp::now(),
        }
    }
    /// returns a copy of the block id
    pub const fn id(&self) -> Id {
        self.id
    }
    /// returns a copy of the block timestamp
    pub const fn timestamp(&self) -> Timestamp {
        self.timestamp
    }
}

impl Default for BlockHeader {
    fn default() -> Self {
        Self {
            id: Id::atomic(),
            timestamp: Timestamp::now(),
        }
    }
}