1use std::{any::Any, fmt::Debug};
2
3pub trait MetaValue: Any + Debug + Send + Sync {
4 fn fields(&self) -> Vec<&'static str>;
5
6 fn get_field<'a>(&'a self, field: &str) -> Option<&'a dyn MetaValue>;
7 fn get_field_mut<'a>(&'a mut self, field: &str) -> Option<&'a mut dyn MetaValue>;
8
9 fn get_index<'a>(&'a self, index: usize) -> Option<&'a dyn MetaValue>;
10 fn get_index_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut dyn MetaValue>;
11
12 fn flatten(&self) -> Vec<&dyn MetaValue>;
13
14 fn as_any(&self) -> &dyn Any;
15
16 fn typename(&self) -> &'static str;
17}