The current interface to read the jump entries of a BrTable operator requires dynamic heap allocation upon parsing. We could remove this by changing the provided interface of BrTable a bit.
Instead of
pub fn read_table(&self) -> Result<(Box<[u32]>, u32)> { .. }
We provide a
pub fn entries(&self) -> impl Iterator<u32> { .. }
Due to creation of BrTable we already have to parse the whole area that is associated to it so we do not have to return a Result here anymore. Also we return an iterator instead of a boxed entity so the user can decide how to process this information and potentially avoid dynamic allocation altogether.
We could even improve upon this by making the returned impl Iterator an ExactSizeIterator.
The current interface to read the jump entries of a
BrTableoperator requires dynamic heap allocation upon parsing. We could remove this by changing the provided interface ofBrTablea bit.Instead of
We provide a
Due to creation of
BrTablewe already have to parse the whole area that is associated to it so we do not have to return aResulthere anymore. Also we return an iterator instead of a boxed entity so the user can decide how to process this information and potentially avoid dynamic allocation altogether.We could even improve upon this by making the returned
impl IteratoranExactSizeIterator.