Case macro for the different kinds of rlp-error structures.
This is an ACL2::fty sum-type case macro, typically introduced by fty::defflexsum or fty::deftagsum. It allows you to safely check the type of a rlp-error structure, or to split into cases based on its type.
In its short form,
(rlp-error-case x :no-bytes)
is essentially just a safer alternative to writing:
(equal (rlp-error-kind x) :no-bytes)
Why is using rlp-error-case safer? When we directly inspect the
kind with
In its longer form,
(rlp-error-case x :no-bytes ... :fewer-bytes-than-short-length ... :fewer-bytes-than-length-of-length ... :fewer-bytes-than-long-length ... :leading-zeros-in-long-length ... :non-optimal-short-length ... :non-optimal-long-length ... :subtree ... :extra-bytes ... :branch-tree ... :leading-zeros-in-scalar ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of