MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / rust_bindings

Function rust_bindings

atomic-audit/src/extract/languages.rs:500–540  ·  view source on GitHub ↗
(node: Node<'_>, source: &str, prefix: Option<&str>, result: &mut Vec<String>)

Source from the content-addressed store, hash-verified

498}
499
500fn rust_bindings(node: Node<'_>, source: &str, prefix: Option<&str>, result: &mut Vec<String>) {
501 match node.kind() {
502 "use_list" => {
503 for child in named(node) {
504 rust_bindings(child, source, prefix, result);
505 }
506 }
507 "scoped_use_list" => {
508 let parent = node
509 .child_by_field_name("path")
510 .map(|path| text(path, source));
511 for list in named(node)
512 .into_iter()
513 .filter(|child| child.kind() == "use_list")
514 {
515 rust_bindings(list, source, parent, result);
516 }
517 }
518 "use_as_clause" => {
519 if let Some(alias) = node.child_by_field_name("alias") {
520 result.push(text(alias, source).into());
521 }
522 }
523 "self" => result.push(
524 prefix
525 .unwrap_or("self")
526 .rsplit("::")
527 .next()
528 .unwrap_or("self")
529 .into(),
530 ),
531 _ => result.push(
532 text(node, source)
533 .rsplit("::")
534 .next()
535 .unwrap_or_default()
536 .trim()
537 .into(),
538 ),
539 }
540}
541
542pub(super) fn dependencies(nodes: &[Node<'_>], source: &str, language: Language) -> Measurement {
543 let mut units = BTreeSet::new();

Callers 1

public_surfaceFunction · 0.85

Calls 6

namedFunction · 0.70
textFunction · 0.70
kindMethod · 0.45
into_iterMethod · 0.45
pushMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected