Table endpoint for generating a truth table from a string expression

This commit is contained in:
Martin Berg Alstad
2024-06-17 00:21:18 +02:00
parent d0198eab5d
commit 6b6f4b4779
7 changed files with 85 additions and 48 deletions

View File

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
use crate::expressions::expression::Expression;
use crate::map;
use crate::routing::options::TruthTableOptions;
use crate::utils::array::Distinct;
type TruthMatrix = Vec<Vec<bool>>;
@ -34,12 +35,6 @@ pub enum Sort {
FalseFirst,
}
#[derive(Debug, Default, Deserialize)]
pub struct TruthTableOptions {
pub sort: Sort,
pub hide: Hide,
}
impl TruthTable {
pub fn new(expression: &Expression, options: TruthTableOptions) -> Self {
let header = Self::extract_header(expression);