safebit 0.1.0

Safe and secure bit access into integer types
Documentation
//! Bitview implementations
//!

use crate::word::Word;
use core::{
    marker::PhantomData,
    ops::{Index, Range},
};
pub struct Bitview<'a, I, Data, DW>
where
    I: Index<usize, Output = DW>,
    Data: AsRef<I>,
    DW: Word,
{
    data: Data,
    phantom1: PhantomData<&'a I>,
    phantom2: PhantomData<&'a DW>,
}
impl<'a, I, Data, DW> Bitview<'a, I, Data, DW>
where
    I: Index<usize, Output = DW>,
    Data: AsRef<I>,
    DW: Word,
{
    pub fn new(data: Data) -> Self {
        Bitview {
            data,
            phantom1: PhantomData,
            phantom2: PhantomData,
        }
    }

    pub fn read<OW>(&self, range: Range<usize>) -> OW
    where
        OW: Word,
    {
        todo!()
    }
}

/*
impl<'a, DW> Bitview<'a, DW>
where
    DW: Word,
{
}
*/