Leverage simplified Python protocols

This commit is contained in:
Dirkjan Ochtman 2021-11-10 09:41:31 +01:00
parent 2d97878ed7
commit c911457226
1 changed files with 2 additions and 5 deletions

View File

@ -2,9 +2,9 @@ use std::fs::File;
use std::io::{BufReader, BufWriter}; use std::io::{BufReader, BufWriter};
use pyo3::exceptions::PyValueError; use pyo3::exceptions::PyValueError;
use pyo3::proc_macro::{pyclass, pymethods, pymodule, pyproto}; use pyo3::proc_macro::{pyclass, pymethods, pymodule};
use pyo3::types::{PyIterator, PyModule}; use pyo3::types::{PyIterator, PyModule};
use pyo3::{PyErr, PyIterProtocol, PyRef, PyRefMut, PyResult, Python}; use pyo3::{PyErr, PyRef, PyRefMut, PyResult, Python};
use smartstring::alias::String as SmartString; use smartstring::alias::String as SmartString;
#[pymodule] #[pymodule]
@ -120,10 +120,7 @@ impl Search {
cur: None, cur: None,
} }
} }
}
#[pyproto]
impl PyIterProtocol for Search {
fn __iter__(slf: PyRef<Self>) -> PyRef<Self> { fn __iter__(slf: PyRef<Self>) -> PyRef<Self> {
slf slf
} }