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
Shapethat matches anyTaggedValueof a given ADT. - Algebraic
Data Type - A tagged-union type: a named set of variants, each with its own fields.
- Match
Arm - One arm of a match: a labelled pattern
Shapeplus optional coverage info. - Pattern
Field - A named field of an ADT variant, carrying the kernel
Shapethat checks and binds its value. - Pattern
Match - The outcome of a successful
match_value: which arm fired, its bindings, and the match score. - Tagged
Value - A constructed ADT value: an ADT name, a variant tag, and named field values.
- Variant
Constructor - A callable builder for one ADT variant.
- Variant
Declaration - One named variant of an
AlgebraicDataType, with its ordered fields. - Variant
Shape - A kernel
Shapethat matches one specific ADT variant by tag and fields.
Functions§
- destructure_
expr - Checks
expragainst a singleshape, returning the kernelShapeMatch. - destructure_
value - Checks
valueagainst a singleshape, returning the kernelShapeMatch. - exhaustiveness_
diagnostics - Returns diagnostics for any
adtvariants not covered byarms. - match_
value - Matches
valueagainstarmsin 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
Valueto aTaggedValue, if it is one.