MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / rs_emit_reference

Function rs_emit_reference

internal/cbm/doclink_rs.c:1738–1749  ·  view source on GitHub ↗

A reference-style link whose label is s[0..n): its destination is the * definition's, or (rustdoc's broken-link callback) the label itself. */

Source from the content-addressed store, hash-verified

1736/* A reference-style link whose label is s[0..n): its destination is the
1737 * definition's, or (rustdoc's broken-link callback) the label itself. */
1738static void rs_emit_reference(rs_sink_t *k, int kind, const char *label, uint32_t n, uint32_t off) {
1739 const char *norm = rs_label_norm(rs_scratch(k->ctx), label, n);
1740 if (!norm || norm[0] == '^') {
1741 return; /* empty, or a footnote */
1742 }
1743 const rs_def_t *def = rs_def_find(k->defs, norm);
1744 if (def) {
1745 rs_emit_link(k, kind, def->dest, def->dest_len, true, off);
1746 } else {
1747 rs_emit_link(k, kind, label, n, false, off);
1748 }
1749}
1750
1751static int rs_run_len_cmp(const void *a, const void *b) {
1752 const rs_run_t *x = (const rs_run_t *)a;

Callers 1

rs_inline_referenceFunction · 0.85

Calls 4

rs_label_normFunction · 0.85
rs_scratchFunction · 0.85
rs_def_findFunction · 0.85
rs_emit_linkFunction · 0.85

Tested by

no test coverage detected