with the upcoming addition of the nodemap logic, it's going to become
more complicated.
Being in the separate impl block has the advantage to be subject to rustfmt,
whereas code inside macro calls isn't.
hg-reviewers |
with the upcoming addition of the nodemap logic, it's going to become
more complicated.
Being in the separate impl block has the advantage to be subject to rustfmt,
whereas code inside macro calls isn't.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | rust/hg-cpython/src/revlog.rs (10 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
00c8efef8c04 | 166f78c3848d | Georges Racinet | Jan 13 2020, 1:56 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | Alphare | ||
Closed | marmoute | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | marmoute | ||
Closed | marmoute |
Err(_) => cindex::Index::new(py, index), | Err(_) => cindex::Index::new(py, index), | ||||
} | } | ||||
} | } | ||||
py_class!(pub class MixedIndex |py| { | py_class!(pub class MixedIndex |py| { | ||||
data cindex: RefCell<cindex::Index>; | data cindex: RefCell<cindex::Index>; | ||||
def __new__(_cls, cindex: PyObject) -> PyResult<MixedIndex> { | def __new__(_cls, cindex: PyObject) -> PyResult<MixedIndex> { | ||||
Self::create_instance(py, RefCell::new( | Self::new(py, cindex) | ||||
cindex::Index::new(py, cindex)?)) | |||||
} | } | ||||
/// Compatibility layer used for Python consumers needing access to the C index | /// Compatibility layer used for Python consumers needing access to the C index | ||||
/// | /// | ||||
/// Only use case so far is `scmutil.shortesthexnodeidprefix`, | /// Only use case so far is `scmutil.shortesthexnodeidprefix`, | ||||
/// that may need to build a custom `nodetree`, based on a specified revset. | /// that may need to build a custom `nodetree`, based on a specified revset. | ||||
/// With a Rust implementation of the nodemap, we will be able to get rid of | /// With a Rust implementation of the nodemap, we will be able to get rid of | ||||
/// this, by exposing our own standalone nodemap class, | /// this, by exposing our own standalone nodemap class, | ||||
} | } | ||||
} | } | ||||
} | } | ||||
}); | }); | ||||
impl MixedIndex { | impl MixedIndex { | ||||
fn new(py: Python, cindex: PyObject) -> PyResult<MixedIndex> { | |||||
Self::create_instance( | |||||
py, | |||||
RefCell::new(cindex::Index::new(py, cindex)?), | |||||
) | |||||
} | |||||
/// forward a method call to the underlying C index | /// forward a method call to the underlying C index | ||||
fn call_cindex( | fn call_cindex( | ||||
&self, | &self, | ||||
py: Python, | py: Python, | ||||
name: &str, | name: &str, | ||||
args: &PyTuple, | args: &PyTuple, | ||||
kwargs: Option<&PyDict>, | kwargs: Option<&PyDict>, | ||||
) -> PyResult<PyObject> { | ) -> PyResult<PyObject> { |