Enum bellframe::Parity[][src]

#[repr(u8)]
pub enum Parity {
    Even,
    Odd,
}
Expand description

Data type representing the parity of a Row. To generate these, you probably want to use [RowTrait::parity]. Note that [RowTrait::parity] always performs a heap allocation and is linear-time in the [Stage] of the Row. If you are using Paritys as optimisations within hot code I would recommend computing them upfront on your input Rows and then tracking them by hand, probably using the * operator.

Note that it would be quite cheap for Rows to track their Parity all the time, but that would result in less-than ideal data layouts and doesn’t fit with the ‘only pay for what you use’ design goal of this library.

Variants

Even

A given Row requires an even number of swaps to return to rounds. This is also often called in course or positive. The parity of rounds on every [Stage].

Odd

A given Row requires an odd number of swaps to return to rounds. This is also often called out of course or negative.

Implementations

Maps true to Parity::Even and false to Parity::Odd. On most machines, this will not actually do anything and be removed by the compiler.

Returns the Parity of a given number.

Returns the Parity of a given number.

Returns the Parity of a given number.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

‘Multiply’ two Paritys together (this corresponds to xor/uncarried addition where Even is 0 and Odd is 1). Also, if you have a Row r1 with Parity p1 and another Row r2 with Parity p2 then (r1 * r2).parity() will always equal p1 * p2. Thus, this can be used to convert calls to [RowTrait::parity] into an extremely cheap (likely single-cycle) update function.

The resulting type after applying the * operator.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.