Skip to content

Commit

Permalink
wip: value storage
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed May 20, 2024
1 parent 274143a commit 851f54f
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/value/indexed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,26 @@ pub struct ValueIndexed {
index: WordIndex,
}

pub trait ValueStorage {
fn words(&self, index: WordIndex) -> &[Word];
fn words_mut(&mut self, index: WordIndex) -> &mut [Word];
pub struct ValueStorage<'a> {
values: &'a [Word],
}

impl ValueIndexed {
pub fn as_ref<'a>(&self, storage: &'a impl ValueStorage) -> BitVecValueRef<'a> {
todo!()
// BitVecValueRef {
// width: self.width,
// words: storage.words(self.index),
// }
}
// impl<'a> From<&'a [Word]> for ValueStorage<'a> {}

pub fn as_mut<'a>(&self, storage: &'a mut impl ValueStorage) -> BitVecValueMutRef<'a> {
todo!()
// BitVecValueMutRef {
// width: self.width,
// words: storage.words_mut(self.index),
// }
}
}
// impl ValueIndexed {
// pub fn as_ref<'a>(&self, storage: &'a impl ValueStorage) -> BitVecValueRef<'a> {
// todo!()
// // BitVecValueRef {
// // width: self.width,
// // words: storage.words(self.index),
// // }
// }
//
// pub fn as_mut<'a>(&self, storage: &'a mut impl ValueStorage) -> BitVecValueMutRef<'a> {
// todo!()
// // BitVecValueMutRef {
// // width: self.width,
// // words: storage.words_mut(self.index),
// // }
// }
// }

0 comments on commit 851f54f

Please sign in to comment.