Skip to content

Commit

Permalink
sketching of iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
flexatone committed Apr 9, 2024
1 parent 0d8ecb8 commit 5d2a4e8
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
use ::xensieve::Sieve as SieveRS;
use ::xensieve::IterValue as IterValueRS;

use pyo3::prelude::*;



// #[pyclass]
// struct IterState {
// iter: Box<dyn Iterator<Item = PyObject> + Send>,
// }

// #[pymethods]
// impl IterState {
// fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
// slf
// }
// fn __next__(mut slf: PyRefMut<'_, Self>) -> Option<PyObject> {
// slf.iter.next()
// }
// }


// #[pyclass]
// struct IterValue {
// inner: IterValueRS<dyn Iterator<Item = i128>>,
// }

// #[pymethods]
// impl IterValue {
// fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
// slf
// }

// fn __next__(mut slf: PyRefMut<'_, Self>) -> Option<i128> {
// None
// // slf.inner.next()
// }
// }



#[pyclass(frozen)]
struct Sieve {
pub(crate) s: SieveRS,
Expand Down Expand Up @@ -47,6 +86,10 @@ impl Sieve {
//--------------------------------------------------------------------------
}





/// A Python module implemented in Rust.
#[pymodule]
fn xensieve(_py: Python, m: &PyModule) -> PyResult<()> {
Expand Down

0 comments on commit 5d2a4e8

Please sign in to comment.