pub trait SourcePlugin:
Send
+ Sync
+ 'static {
// Required methods
fn kind(&self) -> &'static str;
fn config_schema(&self) -> Schema;
fn build(
&self,
name: &SourceName,
config: &Value,
secrets: &dyn SecretResolver,
) -> Result<Box<dyn TaskSource>, SourceError>;
}Expand description
The factory that turns one configuration block into a live TaskSource.
Having the compile-time registry and the subprocess seam be the same shape is the whole reason this is a trait rather than a free function.
Required Methods§
Sourcefn config_schema(&self) -> Schema
fn config_schema(&self) -> Schema
The JSON Schema for this plugin’s own config: block.
Sourcefn build(
&self,
name: &SourceName,
config: &Value,
secrets: &dyn SecretResolver,
) -> Result<Box<dyn TaskSource>, SourceError>
fn build( &self, name: &SourceName, config: &Value, secrets: &dyn SecretResolver, ) -> Result<Box<dyn TaskSource>, SourceError>
Build a live source from one configuration block.
name is the configured source’s name, for error messages only — a
plugin never learns it for any other purpose.
§Errors
Returns SourceError::Config when config is not valid for this
plugin, or SourceError::Auth when a named credential is absent.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".