Crates.io | logical_gate |
lib.rs | logical_gate |
version | 0.1.0-fast |
source | src |
created_at | 2024-03-18 12:21:09.48499 |
updated_at | 2024-03-19 11:45:44.227742 |
description | A logic gate crate. |
homepage | |
repository | |
max_upload_size | |
id | 1177630 |
size | 7,465 |
This crate are imitate computer of logic gate.User can use default struct Bool
.Users can also write some by themselves.
use logical_gate::{io::Bool, logical_gate::logical_gate::*, traits::LogicalGate};
let b1 = true;
let b2 = false;
let mb1 = Bool::new(b1);
let mb2 = Bool::new(b2);
println!("bool true:\t{}\t:can copy:\t{}", b1, b1);
println!("bool false:\t{}\t:can copy:\t{}", b2, b2);
println!("Bool true:\t{}\t:can copy:\t{}", mb1, mb1);
println!("Bool false:\t{}\t:can copy:\t{}", mb2, mb2);
println!();
println!();
println!("bool true:\t{}\t:can clone:\t{}", b1.clone(), b1.clone());
println!("bool false:\t{}\t:can clone:\t{}", b2.clone(), b2.clone());
println!("Bool true:\t{}\t:can clone:\t{}", mb1.clone(), mb1.clone());
println!("Bool false:\t{}\t:can clone:\t{}", mb2.clone(), mb2.clone());
println!();
println!();
println!("bool ord:\t{}>{}\tcan ord\t{}", b1, b2, b1>b2);
println!("Bool ord:\t{}>{}\tcan ord\t{}", mb1, mb2, mb1>mb2);
println!();
println!();
println!("bool and:\t{}&{}\tcan and\t\t{}", b1, b2, b1&b2);
println!("Bool and:\t{}&{}\tcan and\t\t{}", mb1, mb2, logic_and(mb1, mb2));
println!();
println!("bool or:\t{}|{}\tcan or\t\t{}", b1, b2, b1|b2);
println!("Bool or:\t{}|{}\tcan or\t\t{}", mb1, mb2, logic_or(mb1, mb2));
println!();
println!("bool not:\t!{}\t\tcan not\t\t{}", b1, !b1);
println!("Bool not:\t!{}\t\tcan not\t\t{}", mb1, logic_not(mb1));
println!();
println!("orther can please look logical_gate::logical_gate::*");