Skip to main content

is_single_valued_for

Function is_single_valued_for 

Source
pub fn is_single_valued_for(
    index: &SnapshotIndex<'_>,
    expression: &str,
    base: &str,
) -> bool
Expand description

Whether a parameter produces at most one index entry for a resource of type base.

Only the branches a base resource can take count: those rooted at it, and at the universal bases. Every one of them has to reduce to the same path — several branches over one choice element, each casting it to a different type, still select at most one value, because the element holds one type at a time — and that path must not repeat.

And the value has to convert to at most one index entry, for every type it may take: a choice element that can hold a Timing fans out whenever it does.

Anything the walker could not resolve, or that needs the engine, is not single — the cost of being wrong that way is slower storage, and the cost of being wrong the other way is silently dropping values.