eryon-mem 0.0.4

this crate implements the memory-related aspects of the eryon framework
/*
    appellation: impl_block <module>
    authors: @FL03
*/
use super::Block;

use crate::block::BlockHeader;
use scsys::{Id, Timestamp};

impl Block {
    /// returns a new [`Block`] with the given header
    pub const fn new(header: BlockHeader) -> Self {
        Self { header }
    }
    pub fn from_id(id: Id) -> Self {
        Self {
            header: BlockHeader::from_id(id),
        }
    }
    /// returns a reference to the block header
    pub const fn header(&self) -> &BlockHeader {
        &self.header
    }
    /// returns a mutable reference to the block header
    pub const fn header_mut(&mut self) -> &mut BlockHeader {
        &mut self.header
    }
    /// returns a copy of the block id
    pub const fn id(&self) -> Id {
        self.header().id()
    }
    /// returns a copy of the block timestamp
    pub const fn timestamp(&self) -> Timestamp {
        self.header().timestamp()
    }
}