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

Method extract_struct

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

extractStruct — body field REQUIRED (unit structs mint no node; tuple structs' ordered_field_declaration_list is a body).

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

Source from the content-addressed store, hash-verified

582 /// extractStruct — body field REQUIRED (unit structs mint no node; tuple
583 /// structs' ordered_field_declaration_list is a body).
584 fn extract_struct(&mut self, node: Node<'t>) {
585 let Some(body) = node.child_by_field_name("body") else { return };
586 let name = self.extract_name(node);
587 let extra = Extra {
588 docstring: preceding_docstring(node, self.src),
589 visibility: Some(self.visibility_of(node)),
590 ..Extra::default()
591 };
592 let Some(row) = self.create_node("struct", &name, node, extra) else { return };
593 self.extract_inheritance(node, row);
594
595 self.stack.push(Scope { row, kind: "struct", name });
596 for i in 0..body.named_child_count() {
597 if let Some(c) = body.named_child(i) {
598 self.visit_node(c);
599 }
600 }
601 self.stack.pop();
602 }
603
604 /// extractEnum — body required; enum_variant children → enum_member nodes
605 /// (name field only, payloads never walked); other children re-dispatched.

Callers 2

visit_nodeMethod · 0.45

Calls 6

preceding_docstringFunction · 0.85
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected