use std::sync::Arc;
use pedant_types::SourceRecord;
#[derive(Debug)]
pub(crate) struct SnapshotRecordOf<Inventory> {
path: Arc<str>,
text: Arc<str>,
digest: [u8; 32],
inventory: Arc<Inventory>,
}
impl<Inventory> SnapshotRecordOf<Inventory> {
pub(crate) fn of_record(path: &Arc<str>, record: &SourceRecord<Inventory>) -> Self {
Self {
path: Arc::clone(path),
text: record.shared_text(),
digest: *record.digest(),
inventory: record.shared_facts(),
}
}
pub(crate) fn path(&self) -> &str {
&self.path
}
pub(crate) fn shared_path(&self) -> &Arc<str> {
&self.path
}
pub(crate) fn text(&self) -> &str {
&self.text
}
pub(crate) fn digest(&self) -> &[u8; 32] {
&self.digest
}
pub(crate) fn inventory(&self) -> &Inventory {
&self.inventory
}
}