Closed Wodann closed 12 months ago
https://github.com/citahub/cita-trie/blob/0de727ce4835810dd8d5e6a1ef28d73ae2e3f4da/src/db.rs#L48 Because using Arc wrap map, so we prefer use default clone. If you need deep clone you can add a method to achieve it. Ty for your pr.
Given that a deep clone can only be made with access to the private member variables, is it okay to add a deep clone method to the public API? If so, what would you like it to be called @Pencil-Yao?
Achieve deep copy would not make the storage
field be public. Operate MemoryDB object only can use public method, so it's safe, don't worry.
I would like the function interface like
pub fn deep_copy(&self) -> Self
I'm open. @Wodann
New PR created for deep_clone
: https://github.com/citahub/cita_trie/pull/56
Performs a deep clone, creating a separate storage