pub struct SmallTruthTable { /* private fields */ }Expand description
Small truth table with up to 6 input variables. The truth table is stored in a u64.
Implementations§
Source§impl SmallTruthTable
impl SmallTruthTable
Sourcepub fn new<const NUM_INPUTS: usize>(
f: impl Fn([bool; NUM_INPUTS]) -> bool,
) -> Self
pub fn new<const NUM_INPUTS: usize>( f: impl Fn([bool; NUM_INPUTS]) -> bool, ) -> Self
Construct a truth table from a boolean function. The function can have at most 6 inputs.
Sourcepub const fn from_table(table: u64, num_inputs: usize) -> Self
pub const fn from_table(table: u64, num_inputs: usize) -> Self
Create a new truth-table from the bits encoded in an u64.
Sourcepub fn from_boolean_function<F: BooleanFunction>(f: &F) -> Self
pub fn from_boolean_function<F: BooleanFunction>(f: &F) -> Self
Create a small truth table with up to 6 inputs from a generic boolean function.
§Panics
Panics if the boolean function has more than 6 inputs.
Trait Implementations§
Source§impl BooleanFunction for SmallTruthTable
impl BooleanFunction for SmallTruthTable
Source§impl BooleanSystem for SmallTruthTable
impl BooleanSystem for SmallTruthTable
Source§impl Clone for SmallTruthTable
impl Clone for SmallTruthTable
Source§fn clone(&self) -> SmallTruthTable
fn clone(&self) -> SmallTruthTable
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 Debug for SmallTruthTable
impl Debug for SmallTruthTable
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 Hash for SmallTruthTable
impl Hash for SmallTruthTable
Source§impl NumInputs for SmallTruthTable
impl NumInputs for SmallTruthTable
Source§fn num_inputs(&self) -> usize
fn num_inputs(&self) -> usize
Get the number of inputs of the boolean function.
Source§impl NumOutputs for SmallTruthTable
impl NumOutputs for SmallTruthTable
Source§fn num_outputs(&self) -> usize
fn num_outputs(&self) -> usize
Get the number of outputs of the boolean function.
Source§impl Ord for SmallTruthTable
impl Ord for SmallTruthTable
Source§fn cmp(&self, other: &SmallTruthTable) -> Ordering
fn cmp(&self, other: &SmallTruthTable) -> 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 PartialEq for SmallTruthTable
impl PartialEq for SmallTruthTable
Source§impl PartialOrd for SmallTruthTable
impl PartialOrd for SmallTruthTable
Source§impl PartialTruthTable for SmallTruthTable
impl PartialTruthTable for SmallTruthTable
Source§impl SmallTT for SmallTruthTable
impl SmallTT for SmallTruthTable
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 TruthTable for SmallTruthTable
impl TruthTable for SmallTruthTable
Source§impl TruthTableEdit for SmallTruthTable
impl TruthTableEdit for SmallTruthTable
Source§impl<const NUM_INPUTS: usize> TryFrom<SmallTruthTable> for SmallStaticTruthTable<NUM_INPUTS>
impl<const NUM_INPUTS: usize> TryFrom<SmallTruthTable> for SmallStaticTruthTable<NUM_INPUTS>
impl Copy for SmallTruthTable
impl Eq for SmallTruthTable
impl StaticNumOutputs<1> for SmallTruthTable
impl StructuralPartialEq for SmallTruthTable
Auto Trait Implementations§
impl Freeze for SmallTruthTable
impl RefUnwindSafe for SmallTruthTable
impl Send for SmallTruthTable
impl Sync for SmallTruthTable
impl Unpin for SmallTruthTable
impl UnwindSafe for SmallTruthTable
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