pub struct DefRecord {Show 22 fields
pub id: String,
pub name: String,
pub namespace: String,
pub kind: String,
pub line: usize,
pub methods: Vec<String>,
pub properties: Vec<String>,
pub fields: Vec<String>,
pub method_returns: Vec<(String, String)>,
pub extension_methods: Vec<ExtensionMethod>,
pub bases: Vec<String>,
pub type_params: Vec<String>,
pub base_generic_args: Vec<(String, Vec<String>)>,
pub test_methods: Vec<String>,
pub property_types: Vec<(String, Fact)>,
pub field_types: Vec<(String, Fact)>,
pub method_return_args: Vec<(String, Vec<String>)>,
pub non_public_methods: Vec<String>,
pub method_arities: Vec<(String, Vec<(usize, i64)>)>,
pub method_params: Vec<(String, Vec<Vec<String>>)>,
pub override_methods: Vec<String>,
pub end_line: usize,
}Expand description
Represents DefRecord.
Fields§
§id: StringThe id value.
name: StringThe name value.
namespace: StringThe namespace value.
kind: StringThe kind value.
line: usizeThe line value.
methods: Vec<String>The methods value.
properties: Vec<String>Declared property names, source order, deduped
(indexers excluded by construction: indexer_declaration is a
different grammar node). NO accessibility filter, deliberately
asymmetric with methods: static/const/readonly/expression-bodied all
count and only indexers are excluded, so a private member is still a
member of the type. Empty for every
enum-member def.
fields: Vec<String>Declared field names, source order, deduped, every
declarator of every field_declaration (“private int a, b;”
contributes both). event_field_declaration is a distinct node type
and is NOT a field for this purpose. Same no-accessibility-filter
rule as properties.
method_returns: Vec<(String, String)>(method name, declared return type NAME) pairs in
FIRST-declaration source order, parallel to methods (same
is_recorded_method predicate, so the two can never drift). The
first declaration of a name claims the slot outright: a later
overload with a different return type is ignored, and a first
declaration whose return type yields no fact (void, var, a
predefined type) BLOCKS the name rather than letting a later
overload stand in for it. A Vec of pairs, not a map: the serialized
key order is significant (see graph.rs’s FragDef).
extension_methods: Vec<ExtensionMethod>The extension methods this type declares: every method
whose FIRST parameter carries the this modifier, in source order,
deduped by (name, thisType, arityMin, arityMax). Appended LAST, after
method_returns, and omitted at serialization when empty. Unlike
methods there is NO accessibility filter (internal static class FooExtensions is the shape this feature exists for) and no static
check on either the method or its class – C# already disallows a
this parameter anywhere else, so the parameter modifier IS the
discriminator.
bases: Vec<String>The DIRECT base-type identifiers this
declaration lists, in source order, deduped. Same base_list traversal
record_base_list walks for its inherits refs, reduced to a base
IDENTIFIER because the resolver re-RESOLVES these names through the
ordinary ladder rather than matching them; the resulting closure is
what lets the extension tier see an inherited instance member and
decline. Appended after extension_methods and omitted when empty.
type_params: Vec<String>The declaring type’s OWN type-parameter names (class MongoRepository<T> records ["T"]), empty for every non-generic
declaration. This is the ctor-DI resolver’s “is this def itself an
open-generic implementation” signal. Appended after bases, omitted
when empty.
base_generic_args: Vec<(String, Vec<String>)>Per base name that carried a type-argument list, that
list’s generic-arg descriptors relative to type_params (a "*"
wildcard marks a position that is a pass-through of the declaring
type’s own parameter). A Vec of pairs, not a map, for the same
reason method_returns is: the serialized key order is significant.
Appended after type_params, omitted when empty; a base
with no type-argument list at all contributes no entry.
test_methods: Vec<String>The methods this type declares that a test
framework would DISCOVER as tests, in source order, deduped. Appended
LAST, after base_generic_args, and omitted at serialization when
empty. The attribute IS the fact, which is why this is the one member
fact with no accessibility filter at all and why no file, folder or
type-name convention is read anywhere.
property_types: Vec<(String, Fact)>(property name, declared type fact) pairs for exactly the
properties properties records, in the same source order and under the
same dedup. A property whose declared type yields no fact (a predefined
type) has no entry, so the two lists are parallel but not equal in
length. A Vec of pairs, not a map, for the same reason
method_returns is one: the serialized key order is significant.
Appended LAST, after test_methods.
field_types: Vec<(String, Fact)>(field name, declared type fact) pairs for exactly the
fields fields records, in the same source order and under the same
dedup. A field whose declared type yields no fact (a predefined type)
has no entry, so the two lists are parallel but not equal in length.
Every declarator of one field_declaration shares that declaration’s
own type node, so private int a, b; gives a and b the SAME
fact – the same declarator sharing fields’s own collection loop
already relies on. A Vec of pairs, not a map, for the same reason
property_types is one: the serialized key order is significant.
Appended LAST, after property_types.
method_return_args: Vec<(String, Vec<String>)>Per method name that method_returns also records an
entry for, that return type’s top-level generic-arg descriptors –
the same capture base_generic_args keeps beside bases, for the
same reason: method_returns records only the return type’s bare
identifier (“Task” for Task<Order> GetAsync()), and this is what
lets the resolver unwrap ONE Task<...>/ValueTask<...> layer off
an AWAITED call’s callee without ever touching method_returns
itself, which an unawaited use of the very same callee reads
unchanged. A Vec of pairs, not a map, for the same reason
method_returns is one: the serialized key order is significant.
Appended LAST of all, after field_types; a method whose return
type carries no type-argument list at all contributes no entry.
non_public_methods: Vec<String>Declared METHOD names this type does NOT record in methods,
because is_recorded_method gates that list on a literal public
modifier (or kind == "interface", where every method already
counts as public and this list is always empty). Same predicate,
same method_declaration node kind, same source order and dedup as
methods – the two lists partition a type’s method declarations
with no overlap and no gap. Unlike properties/fields, which
already carry every accessibility with no filter at all, methods
needed a counterpart list for a non-public method (protected,
internal, private or no-modifier/private-by-default) to be
recorded anywhere. Consulted by the resolver ONLY for
hierarchy-internal receivers – a base. lookup and the this.
shape’s own typed-receiver walk – never by the scored tier’s
vouching or veto, which keep reading methods alone. Appended
LAST of all, after method_return_args.
method_arities: Vec<(String, Vec<(usize, i64)>)>Method name -> the (min, max) argument-count RANGE every overload
sharing that name accepts, one tuple per overload, in declaration
order – covers EVERY method_declaration, public and non-public
alike (unlike methods/non_public_methods, which only say a name
exists, this says what a CALL of that name needs to look like).
min excludes a parameter carrying a default value or the params
modifier; max is the total parameter count, or -1 (unbounded) when
the trailing parameter is a params array – the same sentinel
ExtensionMethod::arity_max already uses. A Vec of pairs, not a
map, for the same reason method_returns is one: the serialized key
order is significant. Consulted by the resolver’s arity-aware call
vouching: a ref carrying an argCount binds to methods/
non_public_methods only when SOME overload’s range admits it: a
same-named instance member at the wrong arity does not shadow the
extension tier. A read (no argCount) never consults this table.
Appended LAST of all, after non_public_methods.
method_params: Vec<(String, Vec<Vec<String>>)>Method name -> per-overload parameter type descriptors (see
type_descriptor), one Vec<String> per overload in declaration
order – covers EVERY method_declaration, public and non-public
alike, same method set as method_arities. A position naming the
enclosing method’s or type’s own type parameter is recorded as "*"
(wildcard); a parameter carrying the this modifier is written
"this <descriptor>" (the extension-method marker). For a
delegate def this carries exactly one entry, keyed "Invoke",
built from the delegate’s own parameter list (a delegate has no
body, so it is not one of the method_declaration overloads this
otherwise iterates). A Vec of pairs, not a map, for the same
reason method_returns is one: the serialized key order is
significant. Appended LAST of all, after method_arities.
override_methods: Vec<String>Declared method names carrying the literal override modifier,
source order, deduped. Appended LAST of all, after method_params.
Consulted only by the resolver’s member-level overrides pass,
itself run only for a type the resolver already knows is a
registered DI implementation – see graph.rs’s FragDef.
end_line: usize1-based last line of the complete declaration node.
Auto Trait Implementations§
impl Freeze for DefRecord
impl RefUnwindSafe for DefRecord
impl Send for DefRecord
impl Sync for DefRecord
impl Unpin for DefRecord
impl UnsafeUnpin for DefRecord
impl UnwindSafe for DefRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more