Files
brk/parser/src/structs/date_data.rs
2024-06-23 17:38:53 +02:00

21 lines
502 B
Rust

use allocative::Allocative;
use bincode::{Decode, Encode};
use super::{BlockData, BlockPath, WNaiveDate};
#[derive(Debug, Encode, Decode, Allocative)]
pub struct DateData {
pub date: WNaiveDate,
pub blocks: Vec<BlockData>,
}
impl DateData {
pub fn new(date: WNaiveDate, blocks: Vec<BlockData>) -> Self {
Self { date, blocks }
}
pub fn get_block_data(&self, block_path: &BlockPath) -> Option<&BlockData> {
self.blocks.get(block_path.block_index as usize)
}
}