use std::rc::Rc; use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize)] pub struct Reference { object_id: String, content_address: String, path: String, #[serde(skip_serializing_if = "Vec::is_empty")] dependents: Vec>, } impl Reference { pub fn new(object_id: String, content_address: String, path: String) -> Self { Self { object_id, content_address, path, dependents: Vec::new(), } } pub fn add_dep(mut self, dep: Rc) -> Self { self.dependents.push(dep); self } pub fn to_rc(self) -> Rc { Rc::new(self) } }