1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
use crate::object_data::Id; use crate::object_data::ObjectValue; use crate::{index::IndexEntry, ObjectValues}; use crate::{model::Model, IndexEntryProperty}; use std::cell::RefCell; use std::rc::Rc; pub struct HitEntry { pub(in crate) entry: Rc<RefCell<IndexEntry>>, pub(in crate) model: Rc<Model>, } impl HitEntry { pub fn get(&self, property: &str) -> ObjectValue { let entry = self.entry.borrow(); return entry.get(property).clone(); } pub fn get_id(&self) -> Id { let entry = self.entry.borrow(); return entry.get_id().clone(); } pub fn get_model(&self) -> Rc<Model> { return self.model.clone(); } pub fn get_parent_id(&self) -> Option<String> { let entry = self.entry.borrow(); return entry.get_parent_id(); } pub fn get_parent_property(&self) -> Option<String> { let entry = self.entry.borrow(); return entry.get_parent_property(); } pub fn get_parent(&self) -> Option<IndexEntryProperty> { let entry = self.entry.borrow(); return entry.get_parent(); } pub fn get_data(&self) -> ObjectValues { let entry = self.entry.borrow(); entry.data.clone() } }