pub struct NativeBooleanFunction<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize>{ /* private fields */ }
Expand description
A boolean system which is implemented by a Rust function.
Implementations§
Source§impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
Sourcepub fn new(f: F) -> Self
pub fn new(f: F) -> Self
Create a new boolean system from a native boolean function.
§Example
use libreda_logic::traits::*;
use libreda_logic::native_boolean_functions::*;
let f = NativeBooleanFunction::new(|[a, b, c]| [a ^ b ^ c]);
assert_eq!(true, f.evaluate_term(&0, &[true, true, true]));
assert_eq!(false, f.evaluate_term(&0, &[true, true, false]));
Trait Implementations§
Source§impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> BooleanSystem for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> BooleanSystem for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
Source§impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> From<F> for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> From<F> for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
Source§impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> NumInputs for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> NumInputs for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
Source§fn num_inputs(&self) -> usize
fn num_inputs(&self) -> usize
Get the number of inputs of the boolean function.
Source§impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> NumOutputs for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> NumOutputs for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
Source§fn num_outputs(&self) -> usize
fn num_outputs(&self) -> usize
Get the number of outputs of the boolean function.
Source§impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> PartialBooleanSystem for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> PartialBooleanSystem for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> StaticNumInputs<NUM_INPUTS> for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> StaticNumOutputs<NUM_OUTPUTS> for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>
Auto Trait Implementations§
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> Freeze for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>where
F: Freeze,
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> RefUnwindSafe for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>where
F: RefUnwindSafe,
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> Send for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>where
F: Send,
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> Sync for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>where
F: Sync,
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> Unpin for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>where
F: Unpin,
impl<F, const NUM_INPUTS: usize, const NUM_OUTPUTS: usize> UnwindSafe for NativeBooleanFunction<F, NUM_INPUTS, NUM_OUTPUTS>where
F: UnwindSafe,
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> 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