mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Add count.reduce() (#3737)
This commit is contained in:
1 parent
94240f1846
commit
a019cbf02c
1 file changed
+9
-1
@@ -193,7 +193,15 @@ mod decl {
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
impl PyItertoolsCount {}
|
||||
impl PyItertoolsCount {
|
||||
// TODO: Implement this
|
||||
// if (lz->cnt == PY_SSIZE_T_MAX)
|
||||
// return Py_BuildValue("0(00)", Py_TYPE(lz), lz->long_cnt, lz->long_step);
|
||||
#[pymethod(magic)]
|
||||
fn reduce(zelf: PyRef<Self>) -> (PyTypeRef, (BigInt,)) {
|
||||
(zelf.class().clone(), (zelf.cur.read().clone(),))
|
||||
}
|
||||
}
|
||||
impl IterNextIterable for PyItertoolsCount {}
|
||||
impl IterNext for PyItertoolsCount {
|
||||
fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
|
||||
|
||||
Reference in new issue
Block a user