MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extract_interface

Method extract_interface

codegraph-kernel/src/rustlang.rs:632–648  ·  view source on GitHub ↗

extractInterface — kind `trait` (interfaceKind), inheritance from trait_bounds, body children visited with the trait pushed.

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

630 /// extractInterface — kind `trait` (interfaceKind), inheritance from
631 /// trait_bounds, body children visited with the trait pushed.
632 fn extract_interface(&mut self, node: Node<'t>) {
633 stack_guard!();
634 let name = self.extract_name(node);
635 let extra = Extra {
636 docstring: preceding_docstring(node, self.src),
637 ..Extra::default() // no visibility/isExported on the interface path
638 };
639 let Some(row) = self.create_node("trait", &name, node, extra) else { return };
640 self.extract_inheritance(node, row);
641
642 self.stack.push(Scope { row, kind: "trait", name });
643 let body = node.child_by_field_name("body").unwrap_or(node);
644 for c in body.named_children(&mut body.walk()) {
645 self.visit_node(c);
646 }
647 self.stack.pop();
648 }
649
650 /// Extract a Rust struct or union — the body field is OPTIONAL. A unit
651 /// struct (`struct U;`) has no body and is still a complete definition,

Callers 2

visit_nodeMethod · 0.45

Calls 7

preceding_docstringFunction · 0.85
pushMethod · 0.80
extract_nameMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
walkMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected