use crate::traits::Size;
use crate::*;
pub struct AnchoredSlot {
pub inner: Slot,
pub offset: u64,
}
impl AnchoredSlot {
pub fn new(inner: Slot, offset: u64) -> Self {
Self { inner, offset }
}
pub fn width(&self) -> u64 {
self.inner.width()
}
pub fn iter(&self) -> SlotIterator<'_> {
SlotIterator::new(&self.inner)
}
pub fn get_slot_offset(&self, nth: usize) -> Option<u64> {
self.inner.get_slot_offset(nth)
}
pub fn get_free_slot_index(&self) -> Option<usize> {
self.inner.get_free_slot_index()
}
pub fn get_free_slot_offset(&self) -> Option<u64> {
self.inner.get_free_slot_offset()
}
pub fn insert(&mut self, length: u64) -> Result<(), Error> {
self.inner.insert(length)
}
pub fn is_empty(&self, nth: usize) -> Result<bool, Error> {
self.inner.is_empty(nth)
}
pub fn overwrite_crc(&mut self) {
self.inner.overwrite_crc()
}
}
impl Size for AnchoredSlot {
fn size(&self) -> u64 {
self.inner.size()
}
}
impl CrcU32 for AnchoredSlot {
fn crc(&self) -> [u8; 4] {
self.inner.crc()
}
}