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
impl CompositeExternalProvider
Sourcepub fn new(providers: Vec<Box<dyn ExternalConditionProvider>>) -> Self
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.
Sourcepub fn with_defaults(
sector: Option<Sector>,
roles: Option<(Vec<MarketRole>, Vec<MarketRole>)>,
code_list_json: Option<&str>,
) -> Self
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 aSectorProviderroles: If Some((sender_roles, recipient_roles)), adds aMarketRoleProvidercode_list_json: If Some, adds aCodeListProviderloaded from JSONkonfigurationen_json: If Some((json, product_code)), adds aKonfigurationenProvider
Sourcepub fn builder() -> CompositeProviderBuilder
pub fn builder() -> CompositeProviderBuilder
Start building a composite provider with fine-grained control.
Trait Implementations§
Source§impl ExternalConditionProvider for CompositeExternalProvider
impl ExternalConditionProvider for CompositeExternalProvider
Source§fn evaluate(&self, condition_name: &str) -> ConditionResult
fn evaluate(&self, condition_name: &str) -> ConditionResult
Evaluate an external condition by name. Read more
Source§fn now(&self) -> DateTime<Utc>
fn now(&self) -> DateTime<Utc>
The present moment, for conditions that compare against it: UTILMD
[494] “das hier genannte Datum muss der Zeitpunkt sein, zu dem das
Dokument erstellt wurde, oder ein Zeitpunkt, der davor liegt”. The
wall clock by default; a caller on a simulated clock overrides it.Auto Trait Implementations§
impl !RefUnwindSafe for CompositeExternalProvider
impl !UnwindSafe for CompositeExternalProvider
impl Freeze for CompositeExternalProvider
impl Send for CompositeExternalProvider
impl Sync for CompositeExternalProvider
impl Unpin for CompositeExternalProvider
impl UnsafeUnpin for CompositeExternalProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more