pub struct ResolvedSource { /* private fields */ }Expand description
One configured source, built and ready to answer.
Held behind its accessors, and constructible only by resolve, because kind is a
claim about source rather than a value beside it: a caller that could write the two
independently could say linear over a source that reports local-md, and the plan a
query reports names the kind. Building it where the plugin builds the source is what
makes the pair an invariant instead of something every reader has to re-check.
Implementations§
Source§impl ResolvedSource
impl ResolvedSource
Sourcepub fn adopt(name: SourceName, source: Box<dyn TaskSource>) -> Self
pub fn adopt(name: SourceName, source: Box<dyn TaskSource>) -> Self
Adopt a source under name.
The kind is not a second field a caller could set: it is read back off the source
through TaskSource::kind, so the pair cannot disagree and the plan a query
reports names the kind the source itself claims. That also makes this the seam a
source built outside the registry arrives through — the engine’s own tests today,
the subprocess-hosted plugins the protocol document describes later.
Sourcepub fn name(&self) -> &SourceName
pub fn name(&self) -> &SourceName
The name the configuration gave it, which qualifies every id it returns.
Sourcepub fn kind(&self) -> &str
pub fn kind(&self) -> &str
The plugin kind that built it, as the source itself reports it.
A &str rather than a PluginKind: a subprocess-hosted
plugin reports a kind no compile-time enumeration can hold, which is also why
SourcePlan::kind is a String.
Sourcepub fn source(&self) -> &dyn TaskSource
pub fn source(&self) -> &dyn TaskSource
The source itself.
Trait Implementations§
Source§impl Debug for ResolvedSource
impl Debug for ResolvedSource
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Name and kind, the kind spelled the way a configuration spells it rather than
the way Rust spells the variant. A live source has no meaningful Debug of its
own, and one that did would be a rendering of a user’s work — which nothing
outside the plugin may hold.