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

Method define

libs/@local/hashql/core/src/module/std_lib/graph/tail.rs:22–39  ·  view source on GitHub ↗
(lib: &mut StandardLibrary<'_, 'heap>)

Source from the content-addressed store, hash-verified

20 }
21
22 fn define(lib: &mut StandardLibrary<'_, 'heap>) -> ModuleDef<'heap> {
23 let mut def = ModuleDef::new();
24 let heap = lib.heap;
25
26 let graph = lib.manifest::<std_lib::graph::Graph>();
27
28 let mut graph_ty = graph.expect_type(heap.intern_symbol("Graph"));
29 graph_ty.instantiate(&mut lib.instantiate);
30
31 // `collect<T>(graph: Graph<T>) -> List<T>;`
32 let decl = decl!(lib;
33 <T>(graph: lib.ty.apply([(graph_ty.arguments[0].id, T)], graph_ty.id)) -> lib.ty.list(T)
34 );
35
36 func(lib, &mut def, "::graph::tail::collect", &[], decl);
37
38 def
39 }
40}

Callers

nothing calls this directly

Calls 4

funcFunction · 0.85
expect_typeMethod · 0.45
intern_symbolMethod · 0.45
instantiateMethod · 0.45

Tested by

no test coverage detected