Skip to content

Commit

Permalink
Remove unused BitData iterator stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhartman committed Aug 14, 2024
1 parent 39586ba commit 6c5e1e9
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions crates/circuit/src/bit_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use pyo3::prelude::*;
use pyo3::types::PyList;
use std::fmt::Debug;
use std::hash::{Hash, Hasher};
use std::mem::swap;

/// Private wrapper for Python-side Bit instances that implements
/// [Hash] and [Eq], allowing them to be used in Rust hash-based
Expand Down Expand Up @@ -221,37 +220,3 @@ where
self.bits.clear();
}
}

pub struct Iter<'a, T> {
_data: &'a BitData<T>,
index: usize,
}

impl<'a, T> Iterator for Iter<'a, T>
where
T: From<BitType>,
{
type Item = T;

fn next(&mut self) -> Option<Self::Item> {
let mut index = self.index + 1;
swap(&mut self.index, &mut index);
let index: Option<BitType> = index.try_into().ok();
index.map(|i| From::from(i))
}
}

impl<'a, T> IntoIterator for &'a BitData<T>
where
T: From<BitType>,
{
type Item = T;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Self::IntoIter {
Iter {
_data: self,
index: 0,
}
}
}

0 comments on commit 6c5e1e9

Please sign in to comment.