citahub / cita_trie

Rust implementation of the Modified Patricia Tree (aka Trie).
Apache License 2.0
71 stars 28 forks source link

[WIP]refactor: remove root clone #20

Closed yejiayu closed 5 years ago

yejiayu commented 5 years ago

If the node is modified at the time of insert but an error occurs during the process, the necessary clone ensure that the node is consistent with the one before the insert.

cryptowen commented 5 years ago

If the node is modified at the time of insert but an error occurs during the process, the necessary clone ensure that the node is consistent with the one before the insert.

Should the clone in remove function also be modified to take?

yejiayu commented 5 years ago

There is a problem with replacing clone with take. see https://github.com/cryptape/cita-trie/pull/18#discussion_r264109426

A viable solution was mentioned in the comments, but the code modification was a bit large. I have not thought of an elegant solution.