rs_internal_state 0.1.3

This package serves as an essential building block within the `rs_shield` cryptographic library. It is focused on providing foundational functionality and infrastructure for various cryptographic operations within the larger project. While this package has been made publicly available to satisfy the dependency requirements of Rust's cargo system, its utility is predominantly realized in the context of the `rs_shield` project. Unless you are developing or maintaining a component of the `rs_shield` project, this package might offer limited direct utility. For access to a full suite of cryptographic functionalities, consider using the `rs_shield` library bundle.
Documentation
use crate::keccak::WIDTH;
use core::ops::{Index, IndexMut};
use core::slice::{Iter, IterMut};
use rs_n_bit_words::NBitWord;

#[derive(Clone, Copy, Default, Debug, Eq, Hash, PartialEq)]
pub(crate) struct Plane<T> {
    lanes: [NBitWord<T>; WIDTH],
}

impl<T> Index<usize> for Plane<T> {
    type Output = NBitWord<T>;

    fn index(&self, index: usize) -> &Self::Output {
        &self.lanes[index]
    }
}

impl<T> IndexMut<usize> for Plane<T> {
    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
        &mut self.lanes[index]
    }
}

impl<'a, T> IntoIterator for &'a Plane<T> {
    type Item = &'a NBitWord<T>;
    type IntoIter = Iter<'a, NBitWord<T>>;

    fn into_iter(self) -> Self::IntoIter {
        self.lanes.iter()
    }
}

impl<'a, T> IntoIterator for &'a mut Plane<T> {
    type Item = &'a mut NBitWord<T>;
    type IntoIter = IterMut<'a, NBitWord<T>>;

    fn into_iter(self) -> Self::IntoIter {
        self.lanes.iter_mut()
    }
}