comparison rust/hg-cpython/src/dirstate/dirs_multiset.rs @ 43178:1b2200bd06b6

rust-cpython: add safe wrapper representing shared data borrowed from PyObject PySharedRef is a tempoary wrapper around PySharedRefCell. It provides safe functions for each shared data. $shared_accessor implements a safe method to construct PySharedRefCell. This allows us to add more than once PySharedRefCell to a Python object.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 15 Sep 2019 16:50:48 +0900
parents 5cb8867c9e2b
children 7d6758f2d50c
comparison
equal deleted inserted replaced
43177:5cb8867c9e2b 43178:1b2200bd06b6
105 item.extract::<PyBytes>(py)?.data(py).as_ref(), 105 item.extract::<PyBytes>(py)?.data(py).as_ref(),
106 ))) 106 )))
107 } 107 }
108 }); 108 });
109 109
110 py_shared_ref!(Dirs, DirsMultiset, inner); 110 py_shared_ref!(Dirs, DirsMultiset, inner, inner_shared);
111 111
112 impl Dirs { 112 impl Dirs {
113 pub fn from_inner(py: Python, d: DirsMultiset) -> PyResult<Self> { 113 pub fn from_inner(py: Python, d: DirsMultiset) -> PyResult<Self> {
114 Self::create_instance(py, PySharedRefCell::new(d)) 114 Self::create_instance(py, PySharedRefCell::new(d))
115 } 115 }