Skip to main content

CompositeExternalProvider

Struct CompositeExternalProvider 

Source
pub struct CompositeExternalProvider { /* private fields */ }
Expand description

An ExternalConditionProvider that delegates to multiple providers in order.

For each evaluate() call, providers are consulted in sequence. The first provider that returns a non-Unknown result wins. If all providers return Unknown (or there are no providers), Unknown is returned.

This is useful for layering: e.g., a caller-supplied map on top of a system-default provider.

Implementations§

Source§

impl CompositeExternalProvider

Source

pub fn new(providers: Vec<Box<dyn ExternalConditionProvider>>) -> Self

Creates a new CompositeExternalProvider from the given provider list.

Providers are consulted in the order they appear in the vector.

Source

pub fn with_defaults( sector: Option<Sector>, roles: Option<(Vec<MarketRole>, Vec<MarketRole>)>, code_list_json: Option<&str>, ) -> Self

Build a composite provider with the standard static providers.

  • sector: If Some, adds a SectorProvider
  • roles: If Some((sender_roles, recipient_roles)), adds a MarketRoleProvider
  • code_list_json: If Some, adds a CodeListProvider loaded from JSON
  • konfigurationen_json: If Some((json, product_code)), adds a KonfigurationenProvider
Source

pub fn builder() -> CompositeProviderBuilder

Start building a composite provider with fine-grained control.

Trait Implementations§

Source§

impl ExternalConditionProvider for CompositeExternalProvider

Source§

fn evaluate(&self, condition_name: &str) -> ConditionResult

Evaluate an external condition by name. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.