pub struct SmallStaticTruthTable<const NUM_INPUTS: usize> { /* private fields */ }Expand description
Small truth table with up to 6 input variables. The truth table is stored in a u64. The number of inputs is known at compile time.
§Parameters
STATIC_NUM_INPUTS: Number of inputs, known at compile time. Set to0for dynamic input counts.
Implementations§
Source§impl<const NUM_INPUTS: usize> SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> SmallStaticTruthTable<NUM_INPUTS>
Sourcepub fn new(
f: impl Fn([bool; NUM_INPUTS]) -> bool,
) -> SmallStaticTruthTable<NUM_INPUTS>
pub fn new( f: impl Fn([bool; NUM_INPUTS]) -> bool, ) -> SmallStaticTruthTable<NUM_INPUTS>
Construct a truth table from a boolean function. The function can have at most 6 inputs.
Trait Implementations§
Source§impl<const NUM_INPUTS: usize> BooleanFunction for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> BooleanFunction for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const NUM_INPUTS: usize> BooleanSystem for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> BooleanSystem for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const NUM_INPUTS: usize> Clone for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Clone for SmallStaticTruthTable<NUM_INPUTS>
Source§fn clone(&self) -> SmallStaticTruthTable<NUM_INPUTS>
fn clone(&self) -> SmallStaticTruthTable<NUM_INPUTS>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const NUM_INPUTS: usize> Debug for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Debug for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const STATIC_NUM_INPUTS: usize> From<SmallStaticTruthTable<STATIC_NUM_INPUTS>> for SmallTruthTable
impl<const STATIC_NUM_INPUTS: usize> From<SmallStaticTruthTable<STATIC_NUM_INPUTS>> for SmallTruthTable
Source§fn from(tt: SmallStaticTruthTable<STATIC_NUM_INPUTS>) -> Self
fn from(tt: SmallStaticTruthTable<STATIC_NUM_INPUTS>) -> Self
Convert a static number of inputs into a dynamic number of inputs.
Source§impl<const NUM_INPUTS: usize> Hash for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Hash for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const N: usize> NumInputs for SmallStaticTruthTable<N>
impl<const N: usize> NumInputs for SmallStaticTruthTable<N>
Source§fn num_inputs(&self) -> usize
fn num_inputs(&self) -> usize
Get the number of inputs of the boolean function.
Source§impl<const N: usize> NumOutputs for SmallStaticTruthTable<N>
impl<const N: usize> NumOutputs for SmallStaticTruthTable<N>
Source§fn num_outputs(&self) -> usize
fn num_outputs(&self) -> usize
Get the number of outputs of the boolean function.
Source§impl<const NUM_INPUTS: usize> Ord for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Ord for SmallStaticTruthTable<NUM_INPUTS>
Source§fn cmp(&self, other: &SmallStaticTruthTable<NUM_INPUTS>) -> Ordering
fn cmp(&self, other: &SmallStaticTruthTable<NUM_INPUTS>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const NUM_INPUTS: usize> PartialBooleanFunction for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> PartialBooleanFunction for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const NUM_INPUTS: usize> PartialBooleanSystem for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> PartialBooleanSystem for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const NUM_INPUTS: usize> PartialEq for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> PartialEq for SmallStaticTruthTable<NUM_INPUTS>
Source§fn eq(&self, other: &SmallStaticTruthTable<NUM_INPUTS>) -> bool
fn eq(&self, other: &SmallStaticTruthTable<NUM_INPUTS>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<const NUM_INPUTS: usize> PartialOrd for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> PartialOrd for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const NUM_INPUTS: usize> PartialTruthTable for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> PartialTruthTable for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const NUM_INPUTS: usize> SmallTT for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> SmallTT for SmallStaticTruthTable<NUM_INPUTS>
Source§fn bitwise_and(self, other: Self) -> Self
fn bitwise_and(self, other: Self) -> Self
Compute the bitwise AND operation of the output bits.
Source§fn swap_inputs(self, i: usize, j: usize) -> Self
fn swap_inputs(self, i: usize, j: usize) -> Self
Swap two inputs and permute the table accordingly.
Source§fn invert_input(self, i: usize) -> Self
fn invert_input(self, i: usize) -> Self
Create a new truth-table with the
i-th input inverted.Source§fn count_ones(&self) -> usize
fn count_ones(&self) -> usize
Return the number of
true-values in the table.Source§impl<const NUM_INPUTS: usize> TruthTable for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> TruthTable for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const NUM_INPUTS: usize> TruthTableEdit for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> TruthTableEdit for SmallStaticTruthTable<NUM_INPUTS>
Source§impl<const NUM_INPUTS: usize> TryFrom<SmallTruthTable> for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> TryFrom<SmallTruthTable> for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Copy for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Eq for SmallStaticTruthTable<NUM_INPUTS>
impl<const N: usize> StaticNumInputs<N> for SmallStaticTruthTable<N>
impl<const N: usize> StaticNumOutputs<1> for SmallStaticTruthTable<N>
impl<const NUM_INPUTS: usize> StructuralPartialEq for SmallStaticTruthTable<NUM_INPUTS>
Auto Trait Implementations§
impl<const NUM_INPUTS: usize> Freeze for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> RefUnwindSafe for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Send for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Sync for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> Unpin for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> UnwindSafe for SmallStaticTruthTable<NUM_INPUTS>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more