source2_demo/string_table/
row.rs

1use std::rc::Rc;
2
3#[derive(Clone, Default)]
4pub struct StringTableRow {
5    pub(crate) index: i32,
6    pub(crate) key: String,
7    pub(crate) value: Option<Rc<Vec<u8>>>,
8}
9
10impl StringTableRow {
11    pub(crate) fn new(index: i32, key: String, value: Option<Rc<Vec<u8>>>) -> Self {
12        StringTableRow { index, key, value }
13    }
14
15    pub fn index(&self) -> i32 {
16        self.index
17    }
18
19    pub fn key(&self) -> &str {
20        self.key.as_str()
21    }
22
23    pub fn value(&self) -> Option<&[u8]> {
24        self.value.as_ref().map(|x| x.as_slice())
25    }
26}