MCPcopy Create free account
hub / github.com/hashintel/hash / iter

Method iter

libs/@local/codegen/src/lib.rs:111–139  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

109 }
110
111 pub fn iter(&self) -> impl Iterator<Item = (TypeId, &NamedDataType, &TypeDefinition)> {
112 debug_assert_eq!(
113 self.ordered_keys.len(),
114 self.types.len(),
115 "Bug: ordered keys and types should be the same length. The implementation forgot to \
116 update one of them."
117 );
118 self.ordered_keys.iter().map(|key| {
119 (
120 TypeId::from_specta(key.id),
121 self.collection.get(key.id).unwrap_or_else(|| {
122 unreachable!(
123 "TypeCollection should contain a data type for every key in \
124 `ordered_keys` but did not find one for `{}`",
125 key.name
126 )
127 }),
128 self.types
129 .get(&TypeId::from_specta(key.id))
130 .unwrap_or_else(|| {
131 unreachable!(
132 "`TypeCollection` should contain a type for every key in \
133 `ordered_keys` but did not find one for `{}`",
134 key.name,
135 )
136 }),
137 )
138 })
139 }
140
141 pub fn get(&self, id: TypeId) -> Option<&TypeDefinition> {
142 self.types.get(&id)

Callers 15

get_entity_linksFunction · 0.45
entity_idsFunction · 0.45
verify_truth_tableFunction · 0.45
bench_json_queriesFunction · 0.45
seed_dbFunction · 0.45
bench_get_entity_by_idFunction · 0.45

Calls 2

getMethod · 0.65
mapMethod · 0.45

Tested by 4

indexFunction · 0.36
find_available_typesFunction · 0.36