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

Method map

libs/@local/hashql/core/src/module/universe.rs:183–194  ·  view source on GitHub ↗

Transforms the [`Realms `] into a [`Realms `] by applying a function to each value. Maps each value in this container to a new value using the provided closure. Returns a new [`Realms `] containing the mapped values for each universe. # Examples ``` use hashql_core::module::universe::{Realms, Universe}; let mut realms = Realms:: ::new(); realms.of_mut(Universe::Type) = 2; realms.of

(&self, mut closure: impl FnMut(&T) -> U)

Source from the content-addressed store, hash-verified

181 /// assert_eq!(*doubled.of(Universe::Value), 6);
182 /// ```
183 pub fn map<U>(&self, mut closure: impl FnMut(&T) -> U) -> Realms<U>
184 where
185 U: Default,
186 {
187 let mut result = Realms::<U>::new();
188
189 for (universe, value) in self.realms() {
190 *result.of_mut(universe) = closure(value);
191 }
192
193 result
194 }
195
196 /// Tests if any value in this container satisfies the predicate.
197 ///

Callers 12

getMethod · 0.45
absolute_pathMethod · 0.45
resolve_multiMethod · 0.45
resolve_globMethod · 0.45
resolve_implMethod · 0.45
resolve_import_singleMethod · 0.45
resolve_import_multiMethod · 0.45
resolve_import_globMethod · 0.45
resolve_relativeMethod · 0.45
funcFunction · 0.45
makeMethod · 0.45

Calls 2

realmsMethod · 0.80
of_mutMethod · 0.45

Tested by 1

makeMethod · 0.36