pub struct ComputedRegistry { /* private fields */ }Expand description
Registry of computed variables with dependency-ordered evaluation.
Variables are kept in topological order: if var A depends on var B, then B appears before A in the internal list. This invariant is maintained at registration time using Kahn’s algorithm.
Implementations§
Source§impl ComputedRegistry
impl ComputedRegistry
Sourcepub fn new() -> ComputedRegistry
pub fn new() -> ComputedRegistry
Create an empty registry.
Sourcepub fn register(&mut self, var: ComputedVar) -> Result<(), ConfigError>
pub fn register(&mut self, var: ComputedVar) -> Result<(), ConfigError>
Register a computed variable (replacing any existing variable with the same key). Re-sorts the internal list and rebuilds the dependency index.
Returns a ConfigError naming the variables on the cycle if the new
variable would introduce a dependency cycle (including a self-cycle);
the registry is left unchanged in that case.
Sourcepub fn recompute(&self, state: &State) -> Vec<String>
pub fn recompute(&self, state: &State) -> Vec<String>
Recompute all variables in dependency order. Returns the keys whose derived values actually changed (old != new).
Sourcepub fn recompute_affected(
&self,
state: &State,
changed_keys: &[String],
) -> Vec<String>
pub fn recompute_affected( &self, state: &State, changed_keys: &[String], ) -> Vec<String>
Recompute only the variables affected by the given changed keys. Uses the dependency index for O(1) lookup of affected variables, then evaluates them in topological order. Transitively propagates: if a computed var changes, its dependents are also scheduled for recomputation. Returns keys that actually changed.
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validate the dependency graph. Returns Ok(()) if there are no cycles,
or a ConfigError naming the variables on the cycle.
Sourcepub fn describe(&self) -> Vec<ComputedContract>
pub fn describe(&self) -> Vec<ComputedContract>
Return serializable contract metadata for all computed variables.
Trait Implementations§
Source§impl Default for ComputedRegistry
impl Default for ComputedRegistry
Source§fn default() -> ComputedRegistry
fn default() -> ComputedRegistry
Auto Trait Implementations§
impl Freeze for ComputedRegistry
impl !RefUnwindSafe for ComputedRegistry
impl Send for ComputedRegistry
impl Sync for ComputedRegistry
impl Unpin for ComputedRegistry
impl !UnwindSafe for ComputedRegistry
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
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].