Mercurial > hg
diff rust/hg-core/src/dirstate_tree/dispatch.rs @ 47332:4ee9f419c52e
rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs
This will enable the tree-based DirstateMap to not always have an actual
DirstateEntry in memory for all nodes, but construct it on demand.
Differential Revision: https://phab.mercurial-scm.org/D10746
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 19 May 2021 13:15:00 +0200 |
parents | 1766130fe9ba |
children | ed1583a845d2 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dispatch.rs Wed May 19 13:15:00 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dispatch.rs Wed May 19 13:15:00 2021 +0200 @@ -117,7 +117,7 @@ fn contains_key(&self, key: &HgPath) -> bool; - fn get(&self, key: &HgPath) -> Option<&DirstateEntry>; + fn get(&self, key: &HgPath) -> Option<DirstateEntry>; fn iter(&self) -> StateMapIter<'_>; } @@ -290,11 +290,11 @@ (&**self).contains_key(key) } - fn get(&self, key: &HgPath) -> Option<&DirstateEntry> { - (&**self).get(key) + fn get(&self, key: &HgPath) -> Option<DirstateEntry> { + (&**self).get(key).cloned() } fn iter(&self) -> StateMapIter<'_> { - Box::new((&**self).iter().map(|(key, value)| (&**key, value))) + Box::new((&**self).iter().map(|(key, value)| (&**key, *value))) } }