Skip to main content

Module graph

Module graph 

Source
Expand description

Persisted graph and fragment data structures.

Structs§

AlsoIn
Represents AlsoIn.
Candidate
Represents Candidate.
Def
Represents Def.
EdgesByKind
Represents EdgesByKind.
FragDef
Field order is significant: id, name, namespace, kind, line, methods, then the member-fact additions in that exact order – properties, fields, methodReturns – and after those extensionMethods, appended LAST. Each is omitted entirely when empty, so a type declaring none of them serializes exactly as it did before those additions.
FragExtensionMethod
One extensionMethods entry. Serialized field order (name, thisType, arityMin, arityMax, thisArgs) is significant, and serde emits struct fields in declaration order. The two arity halves are NOT optional: they joined the schema with the v6 cache rename, so no fragment this reader can meet is missing them. arity_max is signed because -1 is the unbounded-params sentinel.
FragFact
One declared type fact: the type NAME, plus its top-level type-argument descriptors when the declaration carried any. Field order (type, args) is significant, and args is omitted when absent.
FragName
One declared member, with the line its own NAME token sits on. Field order (name, kind, line, owner) is significant, and owner is omitted when empty – which is how a markup or resource key, owned by no C# type, serializes with three fields.
FragRef
Represents FragRef.
Fragment
Represents Fragment.
FragmentCacheEntry
Represents FragmentCacheEntry.
Graph
Represents Graph.
GraphFile
One file that contributes a graph fragment: C# (defs, refs, member names), markup (x:Class/x:Name, .resw keys – names only) or TS/JS (imports, exported declarations, call/JSX/dispatch references).
GraphName
One row of the full name index. Field order (name, kind, file, line, owner) is significant; owner carries the declaring type’s def id for a member and is omitted for a type, an enum member, and every markup or resource key.
OrderedMap
Represents OrderedMap.
Percent1
Represents Percent1.
Stats
Represents Stats.

Enums§

AnyFragment
The two shapes a cached fragment can have. Each rel is keyed to whichever shape the file’s grammar produced; the ts: 1 tag is what tells them apart, on disk and at the resolver’s door. Untagged, and TS FIRST: a C#/markup fragment carries no ts key (so the TS arm always fails on it) and a TS fragment carries no usings (so the C# arm always fails on it) – the discrimination is total in both directions, never a first-match-wins guess.
Edge
The guess tag, appended LAST on every edge kind that can carry it. heuristic: true is set only on an edge a heuristic tier emitted and never writes heuristic: false, so this side pairs skip_serializing_if with default: absent == precise, and a precise edge’s bytes are exactly what they were before the tag existed. Only the resolver’s heuristic tiers set it today (both uses-member), but the flag lives on all three targeted kinds because the query layer’s heuristic adjacency is kind-keyed, so a future tier tagging a uses-type edge needs no schema change.
FragUsing
Represents FragUsing.
RebuildOutcome
Represents RebuildOutcome.

Functions§

fragment_from_extraction
Build a graph fragment from this crate’s extractor output. Extraction.purpose has no fragment counterpart – the fragment is graph-only.
graph_json_path
Path to the graph artifact (graph.json) for root.
index_is_stale
Whether the fragments index is stale for the given graph files (any mtime mismatch, or a differing file count).
markup_fragment
Markup and resource files never reach the extractor: a line scan reads them instead (see markup.rs). They still get a fragment even when they declare nothing, because the fragments index is what tells map whether the graph’s input set changed, and a file missing from it reads as a permanent mismatch. usings is always empty: XAML has no using-directive equivalent, and the xmlns: prefix declarations that stand in for one are already resolved into fully-qualified ref names by the scan.
read_fragments_index
Read the fragments index (rel -> mtime). Used for the per-file reuse decision, independent of the graph rebuild.
read_graph
Reads and deserializes the repository graph, returning None on failure.
rebuild_graph
fresh_fragments: fragments this run’s extractor produced for files that needed reparsing (the same set that got a fresh purpose signature in the real devscout map flow – mapcmd::map_repo assembles it). changed: from the caller’s own indexIsStale-equivalent check against csFiles, passed in rather than recomputed so the unchanged path never opens any graph file.