Skip to main content

Crate pedant_graph

Crate pedant_graph 

Source
Expand description

Deterministic, language-tagged code topology built from one snapshot-bound symbol-resolution result.

The graph separates three relations a consumer would otherwise have to reconstruct itself: logical containment, source association, and certainty-carrying reference and dependency edges. It consumes already validated in-memory facts and widens nothing: it loads no project, reads no file, parses no source, invokes no build tool, and evaluates no policy.

The snapshot must be the one the resolution was validated against, and a successful build serializes to the compact version-1 JSON described below through serde_json::to_string.

pedant_graph::build_rust_graph(snapshot, resolution)

§The version-1 shape

One object with six keys, in this order:

  • schema_version: the integer CodeGraph::SCHEMA_VERSION.
  • tier: "syntactic" or "semantic", taken from the supplied report.
  • nodes: id, language, name, kind, location. kind is tagged by category; location is null or tagged by kind as file or span.
  • containment: parent and child, sorted by child then parent.
  • references: id, source, language, kind, text, span, gaps, edges, in mint order.
  • edges: id, source, target, kind, certainty, origin, in mint order. origin is tagged by kind as reference or dependency.

Every identity is an integer equal to the record’s position in its own slice, and every graph-owned enum is one lower-snake-case string. No key states a coordinate, a size, a color, or any other layout choice.

Structs§

CodeGraph
One deterministic, language-tagged code topology.
ContainmentEdge
One logical-ownership edge between a parent node and the node it owns.
DependencyEvidence
What one build-unit dependency edge retained from its declaration.
EdgeIdKind
Marker distinguishing edge identities from the other identity kinds.
GraphEdge
One directed relation between two graph nodes.
GraphId
One dense u32 position whose marker fixes the collection it addresses.
GraphLimits
How many nodes, reference records, and edges one build may produce.
GraphNode
One structural entity of a code graph.
GraphReference
One naming site, its copied evidence, and the edges its candidates produced.
NodeIdKind
Marker distinguishing node identities from the other identity kinds.
ReferenceIdKind
Marker distinguishing reference identities from the other identity kinds.

Enums§

GraphBuildError
A refusal taken while projecting one resolution into a graph.
GraphCertainty
How much an edge is known.
GraphCollection
Which graph collection a ceiling addresses.
GraphDependencyKind
Which dependency table declared a build-unit edge.
GraphEdgeKind
What relation an edge states.
GraphEdgeOrigin
Why an edge exists. No edge exists without one of these.
GraphNodeKind
What kind of entity a node is.
GraphNodeLocation
Where a node’s bytes sit, when it has any.
GraphReferenceKind
What a naming site denotes at the graph layer.

Functions§

build_rust_graph
Project one snapshot-bound Rust resolution under the default ceilings.
build_rust_graph_with_limits
Project one snapshot-bound Rust resolution under caller-chosen ceilings.

Type Aliases§

GraphEdgeId
An edge’s dense identity within one crate::CodeGraph.
GraphNodeId
A node’s dense identity within one crate::CodeGraph.
GraphReferenceId
A reference record’s dense identity within one crate::CodeGraph.