pub struct Resolver<'a> { /* private fields */ }
Expand description
Utility to simplify config building and config overrides.
The resolver allows the same initialization logic to be reused for both initial config and override config.
This resolver can be initialized to one of two modes:
- Initial mode: The resolver is being used in a service
Config
builder’sbuild()
method, and thus, there is no config override at this point. - Override mode: The resolver is being used by the
ConfigOverrideRuntimePlugin
’s constructor and needs to incorporate both the original config and the given config override for this operation.
In all the methods on Resolver
, the term “latest” refers to the initial config when in Initial mode,
and to config override when in Override mode.
Implementations§
Source§impl<'a> Resolver<'a>
impl<'a> Resolver<'a>
Sourcepub fn initial(
config: &'a mut CloneableLayer,
components: &'a mut RuntimeComponentsBuilder,
) -> Self
pub fn initial( config: &'a mut CloneableLayer, components: &'a mut RuntimeComponentsBuilder, ) -> Self
Construct a new Resolver
in initial mode.
Sourcepub fn overrid(
initial_config: FrozenLayer,
initial_components: &'a RuntimeComponentsBuilder,
config: &'a mut CloneableLayer,
components: &'a mut RuntimeComponentsBuilder,
) -> Self
pub fn overrid( initial_config: FrozenLayer, initial_components: &'a RuntimeComponentsBuilder, config: &'a mut CloneableLayer, components: &'a mut RuntimeComponentsBuilder, ) -> Self
Construct a new Resolver
in override mode.
Sourcepub fn is_initial(&self) -> bool
pub fn is_initial(&self) -> bool
Returns true if in initial mode.
Sourcepub fn config_mut(&mut self) -> &mut CloneableLayer
pub fn config_mut(&mut self) -> &mut CloneableLayer
Returns a mutable reference to the latest config.
Sourcepub fn runtime_components_mut(&mut self) -> &mut RuntimeComponentsBuilder
pub fn runtime_components_mut(&mut self) -> &mut RuntimeComponentsBuilder
Returns a mutable reference to the latest runtime components.
Sourcepub fn is_latest_set<T>(&self) -> boolwhere
T: Storable<Storer = StoreReplace<T>>,
pub fn is_latest_set<T>(&self) -> boolwhere
T: Storable<Storer = StoreReplace<T>>,
Returns true if the latest config has T
set.
The “latest” is initial for Resolver::Initial
, and override for Resolver::Override
.
Sourcepub fn is_set<T>(&self) -> boolwhere
T: Storable<Storer = StoreReplace<T>>,
pub fn is_set<T>(&self) -> boolwhere
T: Storable<Storer = StoreReplace<T>>,
Returns true if T
is set anywhere.
Sourcepub fn resolve_config<T>(&self) -> <T::Storer as Store>::ReturnedType<'_>where
T: Storable<Storer = StoreReplace<T>>,
pub fn resolve_config<T>(&self) -> <T::Storer as Store>::ReturnedType<'_>where
T: Storable<Storer = StoreReplace<T>>,
Resolves the value T
with fallback
Sourcepub fn sleep_impl(&self) -> Option<SharedAsyncSleep>
pub fn sleep_impl(&self) -> Option<SharedAsyncSleep>
The async sleep implementation.
Sourcepub fn latest_sleep_impl(&self) -> Option<SharedAsyncSleep>
pub fn latest_sleep_impl(&self) -> Option<SharedAsyncSleep>
The async sleep implementation.