Skip to main content

Crate sim_lib_pattern

Crate sim_lib_pattern 

Source
Expand description

Pattern behavior for the SIM runtime over the kernel Shape protocol.

The kernel defines the Shape match/binding protocol; this crate supplies the concrete pattern organ (algebraic data types, destructuring, match arms, and exhaustiveness checking) as pattern surfaces over that protocol.

Structs§

AdtShape
A kernel Shape that matches any TaggedValue of a given ADT.
AlgebraicDataType
A tagged-union type: a named set of variants, each with its own fields.
MatchArm
One arm of a match: a labelled pattern Shape plus optional coverage info.
PatternField
A named field of an ADT variant, carrying the kernel Shape that checks and binds its value.
PatternMatch
The outcome of a successful match_value: which arm fired, its bindings, and the match score.
TaggedValue
A constructed ADT value: an ADT name, a variant tag, and named field values.
VariantConstructor
A callable builder for one ADT variant.
VariantDeclaration
One named variant of an AlgebraicDataType, with its ordered fields.
VariantShape
A kernel Shape that matches one specific ADT variant by tag and fields.

Functions§

destructure_expr
Checks expr against a single shape, returning the kernel ShapeMatch.
destructure_value
Checks value against a single shape, returning the kernel ShapeMatch.
exhaustiveness_diagnostics
Returns diagnostics for any adt variants not covered by arms.
match_value
Matches value against arms in order, returning the first that accepts.
pattern_adt_op_key
Returns the operation key for declaring an ADT.
pattern_destructure_op_key
Returns the operation key for destructuring a value or expression.
pattern_exhaustive_op_key
Returns the operation key for exhaustiveness checking.
pattern_match_op_key
Returns the operation key for matching a value against pattern arms.
pattern_op_keys
Returns every operation key the pattern organ publishes.
pattern_organ_symbol
Returns the organ symbol that identifies the pattern surface.
pattern_tag_op_key
Returns the operation key for constructing a tagged value.
publish_pattern_organ_claims
Publishes the pattern organ and its operation keys as kernel claims.
publish_pattern_organ_claims_for_lib
Publishes pattern organ claims as part of a loaded lib receipt.
tagged_value
Downcasts a runtime Value to a TaggedValue, if it is one.