Skip to main content

SourceCodeConfigurationProvider

Trait SourceCodeConfigurationProvider 

Source
pub trait SourceCodeConfigurationProvider: Send + Sync {
    type Ruleset: Clone + Debug + DeserializeOwned + Serialize + Send + Sync + 'static;

    // Required methods
    fn read_rulesets<'life0, 'life1, 'async_trait>(
        &'life0 self,
        repository: &'life1 Repository,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Ruleset>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn apply_ruleset<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        repository: &'life1 Repository,
        ruleset: &'life2 Self::Ruleset,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Ruleset>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Provider capability for reading and applying complete native rulesets.

The associated type preserves the provider’s complete source-code configuration, including provider-specific rule parameters and unknown fields. A configuration tool that uses this trait chooses a concrete provider and its Ruleset type; policy consumers use AppliedSourceRequirementsProvider instead.

Required Associated Types§

Required Methods§

Source

fn read_rulesets<'life0, 'life1, 'async_trait>( &'life0 self, repository: &'life1 Repository, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Ruleset>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads every ruleset visible for repository in stable provider order.

The provider completely paginates the collection and retains fields it cannot interpret. It returns an explicit crate::ProviderError::Unsupported error when it cannot provide the complete native configuration.

§Errors

Returns crate::ProviderError::NotFound when the repository is absent, crate::ProviderError::MissingCredential when the operation lacks credentials, crate::ProviderError::Unrepresentable when a response cannot be retained without loss, crate::ProviderError::Unsupported when this provider has no complete ruleset implementation, and crate::ProviderError::External for provider read failures.

Source

fn apply_ruleset<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repository: &'life1 Repository, ruleset: &'life2 Self::Ruleset, ) -> Pin<Box<dyn Future<Output = Result<Self::Ruleset>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Creates or replaces the native ruleset identified by ruleset.

The provider-specific value carries the identity and complete desired configuration. The returned value is the provider’s complete accepted representation. The operation never fills omitted fields with Interprex defaults.

§Errors

Returns crate::ProviderError::InvalidInput when ruleset is not a complete writable configuration, crate::ProviderError::NotFound when its repository or existing native identity is absent, crate::ProviderError::MissingCredential when the operation lacks credentials, crate::ProviderError::Unrepresentable when accepted provider data cannot be read or verified without loss, crate::ProviderError::Unsupported when this provider has no complete ruleset implementation, and crate::ProviderError::External for provider refusal or transport failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§