Currently the save_database function uses the serialization of hex view struct directly to save to disk
pub fn save_database(&self) -> Result<(), Box<dyn Error>> {
let toml_string = toml::to_string_pretty(&self.hex_view)?;
And the hex view type looks something like this:
#[derive(Default, Serialize, Deserialize)]
pub struct HexView {
#[serde(skip)]
pub ascii_state: TableState,
// blocks are ByteBlock structs -- ranges with different colors
pub blocks: Vec<ColoredBlock>,
pub bookmarks: Vec<usize>,
#[serde(skip)]
pub changed_bytes: HashMap<usize, String>,
...
}
There are 2 reason that I think it would be better to have a separate type for the "database"
- The on disk format is persistent across runs so it should be "extra stable"
- Sometimes the ideal format for in memory representation is not the same as the one for disk.
with them together we can accidentally break someone's database when trying to update some internal representation.
If they spent a while building up that database for that file, it might be frustrating.
If you think this is a good idea, I can implement it, just wanted to check what you think first
Currently the save_database function uses the serialization of hex view struct directly to save to disk
And the hex view type looks something like this:
There are 2 reason that I think it would be better to have a separate type for the "database"
with them together we can accidentally break someone's database when trying to update some internal representation.
If they spent a while building up that database for that file, it might be frustrating.
If you think this is a good idea, I can implement it, just wanted to check what you think first