https://github.com/coastalwhite/rustlogic
RustLogic is a crate for parsing and handling simple logical expressings with rust.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (6.8%) to scientific vocabulary
Repository
RustLogic is a crate for parsing and handling simple logical expressings with rust.
Basic Info
- Host: GitHub
- Owner: coastalwhite
- Language: Rust
- Default Branch: master
- Size: 47.9 KB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Hello fellow Rustacians! RustLogic is a crate for parsing and handling simple logical expressings.
Description
This crate provides a fast way of parsing logical strings into a tree object. Furthermore, one can insert variables into this equation for single parsing-multiple outputs.
Examples
4-1 Multiplexer
``` use std::collections::HashMap; let multiplexer4to_1 = rustlogic::parse( "([a]&~[x]&~[y])|([b]&~[x]&[y])|([c]&[x]&~[y])|([d]&[x]&[y])" ) .expect("Failed to parse 4-1 multiplexer");
let mut variable_map = HashMap::new();
// Input: 1001 variablemap.insert("a", true); variablemap.insert("b", false); variablemap.insert("c", false); variablemap.insert("d", true);
// Selector: 11 variablemap.insert("x", true); variablemap.insert("y", true);
// Should select fourth item from bus so true let value = multiplexer4to1.getvaluefromvariables(&variable_map).unwrap(); println!("{}", value); // Will print true! ```
Evaluating a logical string with variables and custom logical operators
``` use rustlogic::operators; use std::collections::HashMap;
// Define the set let operatorset = operators::commonsets::worded();
let parsed = rustlogic::customparse("(NOT $[A] AND TRUE) OR $[B]", &operatorset);
// We assign the variables to their values let mut hm = HashMap::new(); hm.insert("A", false); hm.insert("B", false);
// Now contains the value of the logical expression let value = parsed.unwrap().getvaluefrom_variables(&hm).unwrap(); ```
Issues
If you want to want to submit an issue or a pull request, please visit the GitHub page.
Thanks for your time and enjoy this crate!
Owner
- Name: Gijs Burghoorn
- Login: coastalwhite
- Kind: user
- Location: Netherlands
- Company: Polars
- Website: gburghoorn.com
- Repositories: 103
- Profile: https://github.com/coastalwhite
Rusty Hardware and Security Guy 🦀
GitHub Events
Total
Last Year
Committers
Last synced: about 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Gijs Burghoorn | g****n@g****m | 24 |
| coastalwhite | g****d@g****m | 1 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 3
- Total pull requests: 1
- Average time to close issues: 26 days
- Average time to close pull requests: less than a minute
- Total issue authors: 3
- Total pull request authors: 1
- Average comments per issue: 3.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Emily3403 (1)
- Rose1917 (1)
- dpc (1)
Pull Request Authors
- coastalwhite (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cargo 10,336 total
-
Total dependent packages: 2
(may contain duplicates) -
Total dependent repositories: 2
(may contain duplicates) - Total versions: 7
- Total maintainers: 2
crates.io: rustlogic
A Rust Library for basic parsing and handling of logical formulas
- Homepage: https://github.com/coastalwhite/rustlogic
- Documentation: https://docs.rs/rustlogic/
- License: MIT
-
Latest release: 0.2.1
published over 3 years ago
Rankings
Maintainers (1)
crates.io: rustlogic-march1917
A Rust Library for basic parsing and handling of logical formulas(forked from coastalwhite)
- Homepage: https://github.com/Rose1917/rustlogic
- Documentation: https://docs.rs/rustlogic-march1917/
- License: MIT
-
Latest release: 0.1.0
published over 3 years ago