rust/hg-cpython/src/dirstate/dirs_multiset.rs
author Yuya Nishihara <yuya@tcha.org>
Sun, 08 Sep 2019 12:23:18 +0900
changeset 42888 67853749961b
parent 42887 706104dcb2c8
child 42889 ea91a126c803
permissions -rw-r--r--
rust-cpython: replace dyn Iterator<..> of mapping with concrete type See the previous commit for why. The docstring is moved accordingly.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42746
b3518b0baa47 rust-dirstate: create dirstate submodule in hg-cpython
Raphaël Gomès <rgomes@octobus.net>
parents: 42609
diff changeset
     1
// dirs_multiset.rs
42303
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     2
//
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     3
// Copyright 2019 Raphaël Gomès <rgomes@octobus.net>
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     4
//
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     5
// This software may be used and distributed according to the terms of the
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     6
// GNU General Public License version 2 or any later version.
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     7
42746
b3518b0baa47 rust-dirstate: create dirstate submodule in hg-cpython
Raphaël Gomès <rgomes@octobus.net>
parents: 42609
diff changeset
     8
//! Bindings for the `hg::dirstate::dirs_multiset` file provided by the
42303
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     9
//! `hg-core` package.
42746
b3518b0baa47 rust-dirstate: create dirstate submodule in hg-cpython
Raphaël Gomès <rgomes@octobus.net>
parents: 42609
diff changeset
    10
b3518b0baa47 rust-dirstate: create dirstate submodule in hg-cpython
Raphaël Gomès <rgomes@octobus.net>
parents: 42609
diff changeset
    11
use std::cell::RefCell;
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    12
use std::convert::TryInto;
42303
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    13
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    14
use cpython::{
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    15
    exc, ObjectProtocol, PyBytes, PyClone, PyDict, PyErr, PyObject, PyResult,
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    16
    Python,
42303
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    17
};
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    18
42849
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
    19
use crate::dirstate::extract_dirstate;
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
    20
use crate::ref_sharing::{PySharedRefCell, PySharedState};
42887
706104dcb2c8 rust-cpython: replace dyn Iterator<..> of sequence with concrete type
Yuya Nishihara <yuya@tcha.org>
parents: 42851
diff changeset
    21
use hg::{
706104dcb2c8 rust-cpython: replace dyn Iterator<..> of sequence with concrete type
Yuya Nishihara <yuya@tcha.org>
parents: 42851
diff changeset
    22
    DirsMultiset, DirsMultisetIter, DirstateMapError, DirstateParseError,
706104dcb2c8 rust-cpython: replace dyn Iterator<..> of sequence with concrete type
Yuya Nishihara <yuya@tcha.org>
parents: 42851
diff changeset
    23
    EntryState,
706104dcb2c8 rust-cpython: replace dyn Iterator<..> of sequence with concrete type
Yuya Nishihara <yuya@tcha.org>
parents: 42851
diff changeset
    24
};
42303
e240bec26626 rust-dirstate: add rust-cpython bindings to the new parse/pack functions
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    25
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    26
py_class!(pub class Dirs |py| {
42849
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
    27
    data inner: PySharedRefCell<DirsMultiset>;
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    28
    data py_shared_state: PySharedState;
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    29
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    30
    // `map` is either a `dict` or a flat iterator (usually a `set`, sometimes
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    31
    // a `list`)
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    32
    def __new__(
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    33
        _cls,
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    34
        map: PyObject,
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    35
        skip: Option<PyObject> = None
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    36
    ) -> PyResult<Self> {
42749
7ceded4419a3 rust-dirstate: use EntryState enum instead of literals
Raphaël Gomès <rgomes@octobus.net>
parents: 42748
diff changeset
    37
        let mut skip_state: Option<EntryState> = None;
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    38
        if let Some(skip) = skip {
42749
7ceded4419a3 rust-dirstate: use EntryState enum instead of literals
Raphaël Gomès <rgomes@octobus.net>
parents: 42748
diff changeset
    39
            skip_state = Some(
7ceded4419a3 rust-dirstate: use EntryState enum instead of literals
Raphaël Gomès <rgomes@octobus.net>
parents: 42748
diff changeset
    40
                skip.extract::<PyBytes>(py)?.data(py)[0]
7ceded4419a3 rust-dirstate: use EntryState enum instead of literals
Raphaël Gomès <rgomes@octobus.net>
parents: 42748
diff changeset
    41
                    .try_into()
7ceded4419a3 rust-dirstate: use EntryState enum instead of literals
Raphaël Gomès <rgomes@octobus.net>
parents: 42748
diff changeset
    42
                    .map_err(|e: DirstateParseError| {
7ceded4419a3 rust-dirstate: use EntryState enum instead of literals
Raphaël Gomès <rgomes@octobus.net>
parents: 42748
diff changeset
    43
                        PyErr::new::<exc::ValueError, _>(py, e.to_string())
7ceded4419a3 rust-dirstate: use EntryState enum instead of literals
Raphaël Gomès <rgomes@octobus.net>
parents: 42748
diff changeset
    44
                    })?,
7ceded4419a3 rust-dirstate: use EntryState enum instead of literals
Raphaël Gomès <rgomes@octobus.net>
parents: 42748
diff changeset
    45
            );
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    46
        }
42748
7cae6bc29ff9 rust-parsers: switch to parse/pack_dirstate to mutate-on-loop
Raphaël Gomès <rgomes@octobus.net>
parents: 42746
diff changeset
    47
        let inner = if let Ok(map) = map.cast_as::<PyDict>(py) {
7cae6bc29ff9 rust-parsers: switch to parse/pack_dirstate to mutate-on-loop
Raphaël Gomès <rgomes@octobus.net>
parents: 42746
diff changeset
    48
            let dirstate = extract_dirstate(py, &map)?;
42802
2e1f74cc3350 rust-dirstate: split DirsMultiset constructor per input type
Yuya Nishihara <yuya@tcha.org>
parents: 42752
diff changeset
    49
            DirsMultiset::from_dirstate(&dirstate, skip_state)
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    50
        } else {
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    51
            let map: Result<Vec<Vec<u8>>, PyErr> = map
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    52
                .iter(py)?
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    53
                .map(|o| Ok(o?.extract::<PyBytes>(py)?.data(py).to_owned()))
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    54
                .collect();
42802
2e1f74cc3350 rust-dirstate: split DirsMultiset constructor per input type
Yuya Nishihara <yuya@tcha.org>
parents: 42752
diff changeset
    55
            DirsMultiset::from_manifest(&map?)
42748
7cae6bc29ff9 rust-parsers: switch to parse/pack_dirstate to mutate-on-loop
Raphaël Gomès <rgomes@octobus.net>
parents: 42746
diff changeset
    56
        };
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    57
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    58
        Self::create_instance(
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    59
            py,
42849
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
    60
            PySharedRefCell::new(inner),
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    61
            PySharedState::default()
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    62
        )
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    63
    }
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    64
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    65
    def addpath(&self, path: PyObject) -> PyResult<PyObject> {
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    66
        self.borrow_mut(py)?.add_path(
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    67
            path.extract::<PyBytes>(py)?.data(py),
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    68
        );
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    69
        Ok(py.None())
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    70
    }
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    71
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    72
    def delpath(&self, path: PyObject) -> PyResult<PyObject> {
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    73
        self.borrow_mut(py)?.delete_path(
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    74
            path.extract::<PyBytes>(py)?.data(py),
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    75
        )
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    76
            .and(Ok(py.None()))
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    77
            .or_else(|e| {
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    78
                match e {
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    79
                    DirstateMapError::PathNotFound(_p) => {
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    80
                        Err(PyErr::new::<exc::ValueError, _>(
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    81
                            py,
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    82
                            "expected a value, found none".to_string(),
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    83
                        ))
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    84
                    }
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    85
                    DirstateMapError::EmptyPath => {
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    86
                        Ok(py.None())
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    87
                    }
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    88
                }
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    89
            })
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    90
    }
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    91
    def __iter__(&self) -> PyResult<DirsMultisetKeysIterator> {
42851
64e28b891796 rust-cpython: mark unsafe functions as such
Yuya Nishihara <yuya@tcha.org>
parents: 42850
diff changeset
    92
        let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? };
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    93
        DirsMultisetKeysIterator::create_instance(
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    94
            py,
42850
8f549c46bc64 rust-cpython: pair leaked reference with its manager object
Yuya Nishihara <yuya@tcha.org>
parents: 42849
diff changeset
    95
            RefCell::new(Some(leak_handle)),
42887
706104dcb2c8 rust-cpython: replace dyn Iterator<..> of sequence with concrete type
Yuya Nishihara <yuya@tcha.org>
parents: 42851
diff changeset
    96
            RefCell::new(leaked_ref.iter()),
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
    97
        )
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    98
    }
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
    99
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
   100
    def __contains__(&self, item: PyObject) -> PyResult<bool> {
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
   101
        Ok(self
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   102
            .inner(py)
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
   103
            .borrow()
42750
849e744b925d rust-dirstate: improve API of `DirsMultiset`
Raphaël Gomès <rgomes@octobus.net>
parents: 42749
diff changeset
   104
            .contains(item.extract::<PyBytes>(py)?.data(py).as_ref()))
42537
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
   105
    }
ce94f9622acd rust-dirstate: add "dirs" rust-cpython binding
Raphaël Gomès <rgomes@octobus.net>
parents: 42408
diff changeset
   106
});
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   107
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   108
py_shared_ref!(Dirs, DirsMultiset, inner, DirsMultisetLeakedRef,);
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   109
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   110
impl Dirs {
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   111
    pub fn from_inner(py: Python, d: DirsMultiset) -> PyResult<Self> {
42849
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
   112
        Self::create_instance(
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
   113
            py,
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
   114
            PySharedRefCell::new(d),
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
   115
            PySharedState::default(),
8db8fa1de2ef rust-cpython: introduce restricted variant of RefCell
Yuya Nishihara <yuya@tcha.org>
parents: 42802
diff changeset
   116
        )
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   117
    }
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   118
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   119
    fn translate_key(py: Python, res: &Vec<u8>) -> PyResult<Option<PyBytes>> {
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   120
        Ok(Some(PyBytes::new(py, res)))
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   121
    }
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   122
}
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   123
42887
706104dcb2c8 rust-cpython: replace dyn Iterator<..> of sequence with concrete type
Yuya Nishihara <yuya@tcha.org>
parents: 42851
diff changeset
   124
py_shared_iterator_impl!(
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   125
    DirsMultisetKeysIterator,
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   126
    DirsMultisetLeakedRef,
42887
706104dcb2c8 rust-cpython: replace dyn Iterator<..> of sequence with concrete type
Yuya Nishihara <yuya@tcha.org>
parents: 42851
diff changeset
   127
    DirsMultisetIter<'static>,
42752
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   128
    Dirs::translate_key,
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   129
    Option<PyBytes>
30320c7bf79f rust-cpython: add macro for sharing references
Raphaël Gomès <rgomes@octobus.net>
parents: 42750
diff changeset
   130
);