Mercurial > hg
comparison rust/hg-cpython/src/cindex.rs @ 43960:ab3fd8077f5e
rust-index: add a `inner` method to the Index struct
We are about to introduce a Rust wrapper to the C index. It will be exposed as a
Python object. As a start all call will be forwarded to an internal index object
(as used now).
For this forwarding to works, we need to access that index object (from the C
extensions). We adds a method doing to on the existing `Index` rust struct.
Differential Revision: https://phab.mercurial-scm.org/D7654
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Thu, 12 Dec 2019 03:46:47 +0100 |
parents | f384d68d8ea8 |
children | 2728fcb8127c |
comparison
equal
deleted
inserted
replaced
43959:f384d68d8ea8 | 43960:ab3fd8077f5e |
---|---|
69 Ok(Index { | 69 Ok(Index { |
70 index: index, | 70 index: index, |
71 capi: unsafe { revlog_capi::retrieve(py)? }, | 71 capi: unsafe { revlog_capi::retrieve(py)? }, |
72 }) | 72 }) |
73 } | 73 } |
74 | |
75 /// return a reference to the CPython Index object in this Struct | |
76 pub fn inner(&self) -> &PyObject { | |
77 &self.index | |
78 } | |
74 } | 79 } |
75 | 80 |
76 impl Clone for Index { | 81 impl Clone for Index { |
77 fn clone(&self) -> Self { | 82 fn clone(&self) -> Self { |
78 let guard = Python::acquire_gil(); | 83 let guard = Python::acquire_gil(); |