Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-cpython/src/cindex.rs @ 44013:2728fcb8127c
rust-index: make it possible to clone the struct referencing the C index
If we are to hand over the C index object to other code, we need to be able to
create a new python reference to it.
Differential Revision: https://phab.mercurial-scm.org/D7656
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Fri, 13 Dec 2019 19:52:26 +0100 |
parents | ab3fd8077f5e |
children | f5d2720f3bea |
line wrap: on
line diff
--- a/rust/hg-cpython/src/cindex.rs Fri Dec 06 20:40:02 2019 -0500 +++ b/rust/hg-cpython/src/cindex.rs Fri Dec 13 19:52:26 2019 +0100 @@ -88,6 +88,15 @@ } } +impl PyClone for Index { + fn clone_ref(&self, py: Python) -> Self { + Index { + index: self.index.clone_ref(py), + capi: self.capi, + } + } +} + impl Graph for Index { /// wrap a call to the C extern parents function fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> {