aboutsummaryrefslogtreecommitdiff
path: root/common/object/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'common/object/src/lib.rs')
-rw-r--r--common/object/src/lib.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/common/object/src/lib.rs b/common/object/src/lib.rs
index a73de08..98e4834 100644
--- a/common/object/src/lib.rs
+++ b/common/object/src/lib.rs
@@ -160,7 +160,7 @@ impl<'a> Object<'a> {
}
#[inline]
pub fn get_typed<T: ValueLoad<'a>>(&self, index: usize) -> Option<T> {
- if T::ALIGNED {
+ if T::TYPE.is_aligned() {
T::load_aligned(self.get_aligned(index)?)
} else {
T::load_unaligned(self.get_unaligned(index)?)
@@ -326,13 +326,18 @@ pub struct EntriesIter<'a, T> {
impl<'a, T: ValueLoad<'a>> Iterator for EntriesIter<'a, T> {
type Item = (Tag, T);
fn next(&mut self) -> Option<Self::Item> {
- if self.index >= self.object.tags.len() {
- return None;
- } else {
+ loop {
+ if self.index >= self.object.tags.len() {
+ return None;
+ }
+ if T::TYPE != self.object.offset_type(self.index) {
+ self.index += 1;
+ continue;
+ }
let value = self.object.get_typed(self.index)?;
let tag = self.object.tags[self.index];
self.index += 1;
- Some((Tag(tag), value))
+ return Some((Tag(tag), value));
}
}
}