pub enum RefKind {
Free,
Method,
Value,
}Expand description
The syntactic shape of a call site.
A name alone cannot distinguish chain() from x.chain(), and conflating
them makes the resolver attribute a std or dependency method to a same-named
free function that happens to be the only one in the view (#223). Recording
the shape keeps that judgement possible at resolution time.
Variants§
Free
A plain call — foo() — or a path call such as a::b::foo().
Method
A call through a receiver whose type is unknown — x.foo(). The callee
belongs to whatever x is, which the graph does not know, so it may well
be defined outside the view entirely.
Value
A name used as a value rather than called — and_then(helper).
Not a call edge, and deliberately kept out of callers/callees and the
impact walk. It exists so unreferenced can tell a live callback from a
dead function: a path expression records no call, so a function only ever
passed as a value looked unused and was reported as deletable (#250).
Over-inclusive by construction. Extraction is per-file, so it cannot tell
an identifier naming a function from one naming a local; both are
recorded. For unreferenced that errs towards not calling something
dead, which is the safe direction.
Implementations§
Source§impl RefKind
impl RefKind
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
Lowercase name, matching the snake_case serde representation. Used as
the stored value in the persistent graph.
Sourcepub fn from_str_or_free(raw: &str) -> Self
pub fn from_str_or_free(raw: &str) -> Self
Parse from as_str. Anything unrecognized — including
a row written before the column existed — reads as Free, the
pre-existing behaviour.