Mercurial > public > mercurial-scm > hg
diff rust/hg-cpython/src/dirstate/copymap.rs @ 43177:5cb8867c9e2b
rust-cpython: move $leaked struct out of macro
It wasn't easy to hack the $leaked struct since errors in macro would
generate lots of compile errors. Let's make it a plain struct so we can
easily extend it.
PyLeakedRef keeps a more generic PyObject instead of the $name struct
since it no longer has to call any specific methods implemented by
the $name class. $leaked parameter in py_shared_iterator!() is kept
for future change.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 08 Sep 2019 20:26:55 +0900 |
parents | 7a01778bc7b7 |
children | ce6dd1cee4c8 |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/copymap.rs Sun Sep 15 16:04:45 2019 +0900 +++ b/rust/hg-cpython/src/dirstate/copymap.rs Sun Sep 08 20:26:55 2019 +0900 @@ -11,7 +11,8 @@ use cpython::{PyBytes, PyClone, PyDict, PyObject, PyResult, Python}; use std::cell::RefCell; -use crate::dirstate::dirstate_map::{DirstateMap, DirstateMapLeakedRef}; +use crate::dirstate::dirstate_map::DirstateMap; +use crate::ref_sharing::PyLeakedRef; use hg::{utils::hg_path::HgPathBuf, CopyMapIter}; py_class!(pub class CopyMap |py| { @@ -103,7 +104,7 @@ py_shared_iterator!( CopyMapKeysIterator, - DirstateMapLeakedRef, + PyLeakedRef, CopyMapIter<'static>, CopyMap::translate_key, Option<PyBytes> @@ -111,7 +112,7 @@ py_shared_iterator!( CopyMapItemsIterator, - DirstateMapLeakedRef, + PyLeakedRef, CopyMapIter<'static>, CopyMap::translate_key_value, Option<(PyBytes, PyBytes)>