use std::rc::Rc; use std::collections::HashMap; struct MetaClass { file_name: String, idx: i32, prim_key: String, sec_key: String, wrap_list: Vec>, wrap_id_hash: HashMap>, wrap_name_hash: HashMap> } pub struct MetaMgr { meta_classes: Vec>, } impl MetaMgr { pub fn new() -> Self { return MetaMgr::{ meta_classes: Vec::new() }; } pub fn init(&mut self) { } pub fn un_init(&mut self) { } pub fn get_byid(&mut self, idx: i32, id: i64) -> Option<&Rc> { return self.internal_get_byid(idx as usize, id); } pub fn internal_get_byid(&mut self, idx: usize, id: i64) -> Option<&Rc> { if idx >= 0 && idx <= self.meta_classes.len() { match self.meta_classes[idx].wrap_id_hash.get(&id) { Some(v) => { return Some(v); } None => { } } } return None; } }