Skip to content

Commit 5b429ce

Browse files
bobrikdwrensha
authored andcommitted
Resolve Field type in creation
1 parent a31dce8 commit 5b429ce

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

capnp/src/schema.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ impl From<RawBrandedStructSchema> for StructSchema {
132132
pub struct Field {
133133
proto: field::Reader<'static>,
134134
index: u16,
135+
kind: introspect::Type,
135136
pub(crate) parent: StructSchema,
136137
}
137138

@@ -141,7 +142,7 @@ impl Field {
141142
}
142143

143144
pub fn get_type(&self) -> introspect::Type {
144-
(self.parent.raw.field_types)(self.index)
145+
self.kind
145146
}
146147

147148
pub fn get_index(&self) -> u16 {
@@ -177,6 +178,7 @@ impl FieldList {
177178
Field {
178179
proto: self.fields.get(index as u32),
179180
index,
181+
kind: (self.parent.raw.field_types)(index),
180182
parent: self.parent,
181183
}
182184
}
@@ -223,6 +225,7 @@ impl FieldSubset {
223225
Field {
224226
proto: self.fields.get(index as u32),
225227
index,
228+
kind: (self.parent.raw.field_types)(index),
226229
parent: self.parent,
227230
}
228231
}

0 commit comments

Comments
 (0)