Skip to main content

Module permute

Module permute 

Source
Expand description

Combinators for parsing permutations of sub-parsers.

Each Permute* combinator accepts any ordering of its components while its serializer always emits the declared order. That makes them deliberately malleable: distinct byte strings map to the same value, so NonMalleable and PSRoundTrip are not available. Soundness is, because reordering preserves the total length.

Only widths 2 to 5 are provided. The construction enumerates orderings, so the number of parse paths grows as N! (Permute4 has 24, Permute5 has 120).

Modules§

exec
Executable parser and serializer implementations for this combinator. Executable implementations for permutation formats.
proof
Proofs of the security and correctness properties for this combinator. Correctness and malleability proofs for permutation formats.
spec
Specification trait implementations for this combinator. Specifications for formats accepting multiple component orders.

Structs§

Permute2
Permute2<P1, P2> parses either (P1, P2) or (P2, P1) and produces (P1::PVal, P2::PVal)
Permute3
Permute3<A, B, C> parses any permutation of A, B, C and produces (A::PVal, (B::PVal, C::PVal))
Permute4
Permute4<A, B, C, D> parses any permutation and produces (A::PVal, (B::PVal, (C::PVal, D::PVal)))
Permute5
Permute5<A, B, C, D, E> parses any permutation and produces (A::PVal, (B::PVal, (C::PVal, (D::PVal, E::PVal))))

Functions§

swap2
swap3_1
swap3_2
swap4_1
swap4_2
swap4_3
swap5_1
swap5_2
swap5_3
swap5_4