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.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/object/src/lib.rs b/common/object/src/lib.rs
index 7d0c203..3e60d58 100644
--- a/common/object/src/lib.rs
+++ b/common/object/src/lib.rs
@@ -154,14 +154,14 @@ impl<'a> Object<'a> {
Some(&values_u8[start as usize..end as usize])
}
#[inline]
- pub fn get_typed<T: Value<'a>>(&self, index: usize) -> Option<T> {
+ pub fn get_typed<T: ValueLoad<'a>>(&self, index: usize) -> Option<T> {
if T::ALIGNED {
T::load_aligned(self.get_aligned(index)?)
} else {
T::load_unaligned(self.get_unaligned(index)?)
}
}
- pub fn get<T: Value<'a>>(&self, tag: TypedTag<T>) -> Option<T> {
+ pub fn get<T: ValueLoad<'a>>(&self, tag: TypedTag<T>) -> Option<T> {
self.get_typed(self.find_field(tag.0)?)
}
pub fn keys(&self) -> KeysIter<'a> {
@@ -186,7 +186,7 @@ impl<'a> Object<'a> {
}
}
#[must_use]
- pub fn extend<T: Value<'a> + Eq + Ord>(
+ pub fn extend<T: ValueLoad<'a> + Eq + Ord>(
&self,
tag: TypedTag<T>,
values: impl IntoIterator<Item = T>,
@@ -318,13 +318,13 @@ pub struct EntriesIter<'a, T> {
index: usize,
ty: PhantomData<T>,
}
-impl<'a, T: Value<'a>> Iterator for 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 {
- let value = self.object.get_typed(self.index)?; //? This ends the iterator early if there is any invalid field
+ let value = self.object.get_typed(self.index)?;
let tag = self.object.tags[self.index];
self.index += 1;
Some((Tag(tag), value))
@@ -338,7 +338,7 @@ pub struct FieldIter<'a, T> {
tag: u32,
ty: PhantomData<T>,
}
-impl<'a, T: Value<'a>> Iterator for FieldIter<'a, T> {
+impl<'a, T: ValueLoad<'a>> Iterator for FieldIter<'a, T> {
type Item = T;
fn next(&mut self) -> Option<Self::Item> {
if self.index >= self.object.tags.len() {