pub struct OperatorSet { /* private fields */ }
Expand description
OperatorSet struct used to specify non-default operator symbols for custom_parse function
§Examples
§Using the common sets
use rustlogic::operators;
let mathematical_version = operators::common_sets::mathematical();
// We create a parsed logic node
let parse_result = rustlogic::custom_parse("(![A]*[B])+[C]", &mathematical_version);
// -- snipp
For all the common sets click here
§Defining your own sets
use rustlogic::operators::OperatorSet;
// Create a operator set with words
let worded_version = OperatorSet::new(
" AND ", " OR ", "NOT ", "TRUE", "FALSE", "(", ")", "$[", "]",
);
// Attempt to parse a logical string
let parse_result = rustlogic::custom_parse("(NOT $[A] AND $[B]) OR $[C]", &worded_version);
// -- snipp
§Adjusting a pre-existing set
use rustlogic::operators;
// Adjust the group brackets to be curly
let curly_bracket_groups = operators::common_sets::default()
.adjust_group_open("{")
.adjust_group_close("}");
// We create a parsed logic node
let parse_result = rustlogic::custom_parse("{~[A]&[B]}|[C]", &curly_bracket_groups);
// -- snipp
Implementations§
Source§impl OperatorSet
impl OperatorSet
pub fn new( and: &str, or: &str, not: &str, true_symbol: &str, false_symbol: &str, group_open: &str, group_close: &str, variable_open: &str, variable_close: &str, ) -> OperatorSet
Sourcepub fn adjust_and(self, to: &str) -> OperatorSet
pub fn adjust_and(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn and(&self) -> &str
pub fn and(&self) -> &str
Getter used to fetch operator within OperatorSet
Sourcepub fn adjust_or(self, to: &str) -> OperatorSet
pub fn adjust_or(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn or(&self) -> &str
pub fn or(&self) -> &str
Getter used to fetch operator within OperatorSet
Sourcepub fn adjust_not(self, to: &str) -> OperatorSet
pub fn adjust_not(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn not(&self) -> &str
pub fn not(&self) -> &str
Getter used to fetch operator within OperatorSet
Sourcepub fn adjust_true_symbol(self, to: &str) -> OperatorSet
pub fn adjust_true_symbol(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn true_symbol(&self) -> &str
pub fn true_symbol(&self) -> &str
Getter used to fetch operator within OperatorSet
Sourcepub fn adjust_false_symbol(self, to: &str) -> OperatorSet
pub fn adjust_false_symbol(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn false_symbol(&self) -> &str
pub fn false_symbol(&self) -> &str
Getter used to fetch operator within OperatorSet
Sourcepub fn adjust_group_open(self, to: &str) -> OperatorSet
pub fn adjust_group_open(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn group_open(&self) -> &str
pub fn group_open(&self) -> &str
Getter used to fetch operator within OperatorSet
Sourcepub fn adjust_group_close(self, to: &str) -> OperatorSet
pub fn adjust_group_close(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn group_close(&self) -> &str
pub fn group_close(&self) -> &str
Getter used to fetch operator within OperatorSet
Sourcepub fn adjust_variable_open(self, to: &str) -> OperatorSet
pub fn adjust_variable_open(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn variable_open(&self) -> &str
pub fn variable_open(&self) -> &str
Getter used to fetch operator within OperatorSet
Sourcepub fn adjust_variable_close(self, to: &str) -> OperatorSet
pub fn adjust_variable_close(self, to: &str) -> OperatorSet
Setter used to adjust operator within OperatorSet
Sourcepub fn variable_close(&self) -> &str
pub fn variable_close(&self) -> &str
Getter used to fetch operator within OperatorSet
Trait Implementations§
Source§impl Clone for OperatorSet
impl Clone for OperatorSet
Source§fn clone(&self) -> OperatorSet
fn clone(&self) -> OperatorSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more