pub trait SourceFactory:
SourceDefProvider
+ Send
+ Sync
+ 'static {
// Required methods
fn kind(&self) -> &'static str;
fn build<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
spec: &'life1 ResolvedSourceSpec,
ctx: &'life2 SourceBuildCtx,
) -> Pin<Box<dyn Future<Output = SourceResult<SourceSvcIns>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided method
fn validate_spec(&self, _spec: &ResolvedSourceSpec) -> SourceResult<()> { ... }
}Required Methods§
fn kind(&self) -> &'static str
fn build<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
spec: &'life1 ResolvedSourceSpec,
ctx: &'life2 SourceBuildCtx,
) -> Pin<Box<dyn Future<Output = SourceResult<SourceSvcIns>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Provided Methods§
Sourcefn validate_spec(&self, _spec: &ResolvedSourceSpec) -> SourceResult<()>
fn validate_spec(&self, _spec: &ResolvedSourceSpec) -> SourceResult<()>
可选:轻量级参数校验(不产生 I/O),用于尽早暴露参数错误。