Skip to content

Commit

Permalink
Remove unused U64Field implementation for Storable (#334)
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Pringle <richard.pringle@avalabs.org>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
  • Loading branch information
rkuris and richardpringle authored Oct 31, 2023
1 parent 1bafa21 commit 8b97e1e
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions shale/src/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,47 +213,6 @@ impl Storable for CompactSpaceHeader {
}
}

#[derive(Debug)]
struct U64Field(u64);

impl U64Field {
const MSIZE: u64 = 8;
}

impl Storable for U64Field {
fn hydrate<U: CachedStore>(addr: usize, mem: &U) -> Result<Self, ShaleError> {
let raw = mem
.get_view(addr, Self::MSIZE)
.ok_or(ShaleError::InvalidCacheView {
offset: addr,
size: Self::MSIZE,
})?;
Ok(Self(u64::from_le_bytes(raw.as_deref().try_into().unwrap())))
}

fn dehydrated_len(&self) -> u64 {
Self::MSIZE
}

fn dehydrate(&self, to: &mut [u8]) -> Result<(), ShaleError> {
Cursor::new(to).write_all(&self.0.to_le_bytes())?;
Ok(())
}
}

impl std::ops::Deref for U64Field {
type Target = u64;
fn deref(&self) -> &u64 {
&self.0
}
}

impl std::ops::DerefMut for U64Field {
fn deref_mut(&mut self) -> &mut u64 {
&mut self.0
}
}

#[derive(Debug)]
struct CompactSpaceInner<M> {
meta_space: Arc<M>,
Expand Down

0 comments on commit 8b97e1e

Please sign in to comment.